| 1 |
; Check that the JSON output from DTLTO is as expected. Note that validate.py |
| 2 |
; checks the JSON structure so we just check the field contents in this test. |
| 3 |
|
| 4 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 5 |
|
| 6 |
; Generate bitcode files with summary. |
| 7 |
RUN: opt -thinlto-bc t1.ll -o t1.bc |
| 8 |
RUN: opt -thinlto-bc t2.ll -o t2.bc |
| 9 |
|
| 10 |
; Perform DTLTO with clang. |
| 11 |
RUN: not llvm-lto2 run t1.bc t2.bc -o my.output \ |
| 12 |
RUN: -r=t1.bc,t1,px -r=t2.bc,t2,px \ |
| 13 |
RUN: -dtlto-distributor=%python \ |
| 14 |
RUN: -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py,--da1=10,--da2=10 \ |
| 15 |
RUN: -dtlto-compiler=my_clang.exe \ |
| 16 |
RUN: -dtlto-compiler-arg=--rota1=10,--rota2=20 \ |
| 17 |
RUN: 2>&1 | FileCheck --check-prefixes=CHECK,CLANG %s |
| 18 |
|
| 19 |
; Perform DTLTO with LLVM driver. |
| 20 |
RUN: not llvm-lto2 run t1.bc t2.bc -o my.output \ |
| 21 |
RUN: -r=t1.bc,t1,px -r=t2.bc,t2,px \ |
| 22 |
RUN: -dtlto-distributor=%python \ |
| 23 |
RUN: -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py,--da1=10,--da2=10 \ |
| 24 |
RUN: -dtlto-compiler=llvm \ |
| 25 |
RUN: -dtlto-compiler-prepend-arg=clang \ |
| 26 |
RUN: -dtlto-compiler-arg=--rota1=10,--rota2=20 \ |
| 27 |
RUN: 2>&1 | FileCheck --check-prefixes=CHECK,LLVM %s |
| 28 |
|
| 29 |
CHECK: distributor_args=['--da1=10', '--da2=10'] |
| 30 |
|
| 31 |
; Check the common object. |
| 32 |
CHECK: "linker_output": "my.output" |
| 33 |
CHECK: "args": |
| 34 |
CLANG-NEXT: "my_clang.exe" |
| 35 |
LLVM-NEXT: "llvm" |
| 36 |
LLVM-NEXT: "clang" |
| 37 |
CHECK-NEXT: "-c" |
| 38 |
CHECK-NEXT: "--target=x86_64-unknown-linux-gnu" |
| 39 |
CHECK-NEXT: "-O2" |
| 40 |
CHECK-NEXT: "-fpic" |
| 41 |
CHECK-NEXT: "-Wno-unused-command-line-argument" |
| 42 |
CHECK-NEXT: "--rota1=10" |
| 43 |
CHECK-NEXT: "--rota2=20" |
| 44 |
CHECK-NEXT: ] |
| 45 |
CHECK: "inputs": [] |
| 46 |
|
| 47 |
; Check the first job entry. |
| 48 |
CHECK: "args": |
| 49 |
CHECK-NEXT: "t1.bc" |
| 50 |
CHECK-NEXT: "-fthinlto-index=t1.1.[[#]].native.o.thinlto.bc" |
| 51 |
CHECK-NEXT: "-o" |
| 52 |
CHECK-NEXT: "t1.1.[[#]].native.o" |
| 53 |
CHECK-NEXT: ] |
| 54 |
CHECK: "inputs": [ |
| 55 |
CHECK-NEXT: "t1.bc" |
| 56 |
CHECK-NEXT: "t1.1.[[#]].native.o.thinlto.bc" |
| 57 |
CHECK-NEXT: ] |
| 58 |
CHECK: "outputs": [ |
| 59 |
CHECK-NEXT: "t1.1.[[#]].native.o" |
| 60 |
CHECK-NEXT: ] |
| 61 |
|
| 62 |
; Check the second job entry. |
| 63 |
CHECK: "args": [ |
| 64 |
CHECK-NEXT: "t2.bc" |
| 65 |
CHECK-NEXT: "-fthinlto-index=t2.2.[[#]].native.o.thinlto.bc" |
| 66 |
CHECK-NEXT: "-o" |
| 67 |
CHECK-NEXT: "t2.2.[[#]].native.o" |
| 68 |
CHECK-NEXT: ] |
| 69 |
CHECK-NEXT: "inputs": [ |
| 70 |
CHECK-NEXT: "t2.bc" |
| 71 |
CHECK-NEXT: "t2.2.[[#]].native.o.thinlto.bc" |
| 72 |
CHECK-NEXT: ] |
| 73 |
CHECK-NEXT: "outputs": [ |
| 74 |
CHECK-NEXT: "t2.2.[[#]].native.o" |
| 75 |
CHECK-NEXT: ] |
| 76 |
|
| 77 |
; This check ensures that we have failed for the expected reason. |
| 78 |
CHECK: failed: DTLTO backend compilation: cannot open native object file: |
| 79 |
|
| 80 |
;--- t1.ll |
| 81 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 82 |
target triple = "x86_64-unknown-linux-gnu" |
| 83 |
|
| 84 |
define void @t1() { |
| 85 |
entry: |
| 86 |
ret void |
| 87 |
} |
| 88 |
|
| 89 |
;--- t2.ll |
| 90 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 91 |
target triple = "x86_64-unknown-linux-gnu" |
| 92 |
|
| 93 |
define void @t2() { |
| 94 |
entry: |
| 95 |
ret void |
| 96 |
} |