| 1 |
; Test that DTLTO uses the target triple from the first file in the link. |
| 2 |
|
| 3 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 4 |
|
| 5 |
; Generate bitcode files with summary. |
| 6 |
RUN: opt -thinlto-bc t1.ll -o t1.bc |
| 7 |
RUN: opt -thinlto-bc t2.ll -o t2.bc |
| 8 |
|
| 9 |
; Define a substitution to share the common DTLTO arguments. Note that the use |
| 10 |
; of validate.py will cause a failure as it does not create output files. |
| 11 |
DEFINE: %{command} = llvm-lto2 run -o t.o -save-temps \ |
| 12 |
DEFINE: -dtlto-distributor=%python \ |
| 13 |
DEFINE: -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py \ |
| 14 |
DEFINE: -r=t1.bc,t1,px \ |
| 15 |
DEFINE: -r=t2.bc,t2,px |
| 16 |
|
| 17 |
; Test case where t1.bc is first. |
| 18 |
RUN: not %{command} t1.bc t2.bc 2>&1 | FileCheck %s \ |
| 19 |
RUN: --check-prefixes=TRIPLE1,ERR --implicit-check-not=--target |
| 20 |
TRIPLE1: --target=x86_64-unknown-linux-gnu |
| 21 |
|
| 22 |
; Test case where t2.bc is first. |
| 23 |
RUN: not %{command} t2.bc t1.bc 2>&1 | FileCheck %s \ |
| 24 |
RUN: --check-prefixes=TRIPLE2,ERR --implicit-check-not=--target |
| 25 |
TRIPLE2: --target=x86_64-unknown-unknown-gnu |
| 26 |
|
| 27 |
; This check ensures that we have failed for the expected reason. |
| 28 |
ERR: failed: DTLTO backend compilation: cannot open native object file: |
| 29 |
|
| 30 |
;--- t1.ll |
| 31 |
|
| 32 |
target triple = "x86_64-unknown-linux-gnu" |
| 33 |
|
| 34 |
define void @t1() { |
| 35 |
ret void |
| 36 |
} |
| 37 |
|
| 38 |
;--- t2.ll |
| 39 |
|
| 40 |
target triple = "x86_64-unknown-unknown-gnu" |
| 41 |
|
| 42 |
define void @t2() { |
| 43 |
ret void |
| 44 |
} |