| 1 |
; Check that DTLTO creates imports lists correctly. |
| 2 |
|
| 3 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 4 |
|
| 5 |
; Generate ThinLTO bitcode files. |
| 6 |
RUN: opt -thinlto-bc 0.ll -o 0.bc -O2 |
| 7 |
RUN: opt -thinlto-bc 1.ll -o 1.bc -O2 |
| 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 0.bc 1.bc -o t.o \ |
| 12 |
DEFINE: -dtlto-distributor=%python \ |
| 13 |
DEFINE: -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py \ |
| 14 |
DEFINE: -r=0.bc,g,px \ |
| 15 |
DEFINE: -r=1.bc,f,px \ |
| 16 |
DEFINE: -r=1.bc,g |
| 17 |
|
| 18 |
; We expect an import from 0.bc into 1.bc but no imports into 0.bc. Check that |
| 19 |
; the expected input files have been added to the JSON to account for this. |
| 20 |
RUN: not %{command} 2>&1 | FileCheck %s --check-prefixes=INPUTS,ERR |
| 21 |
|
| 22 |
; 1.bc should not appear in the list of inputs for 0.bc. |
| 23 |
INPUTS: "jobs": |
| 24 |
INPUTS: "inputs": [ |
| 25 |
INPUTS-NEXT: "0.bc", |
| 26 |
INPUTS-NEXT: "0.1.[[#]].native.o.thinlto.bc" |
| 27 |
INPUTS-NEXT: ] |
| 28 |
|
| 29 |
; 0.bc should appear in the list of inputs for 1.bc. |
| 30 |
INPUTS: "inputs": [ |
| 31 |
INPUTS-NEXT: "1.bc", |
| 32 |
INPUTS-NEXT: "1.2.[[#]].native.o.thinlto.bc", |
| 33 |
INPUTS-NEXT: "0.bc" |
| 34 |
INPUTS-NEXT: ] |
| 35 |
|
| 36 |
; This check ensures that we have failed for the expected reason. |
| 37 |
ERR: failed: DTLTO backend compilation: cannot open native object file: |
| 38 |
|
| 39 |
|
| 40 |
; Check that imports files are not created even if -save-temps is active. |
| 41 |
RUN: not %{command} -save-temps 2>&1 \ |
| 42 |
RUN: | FileCheck %s --check-prefixes=ERR |
| 43 |
RUN: ls | FileCheck %s --check-prefix=NOIMPORTSFILES |
| 44 |
NOIMPORTSFILES-NOT: imports |
| 45 |
|
| 46 |
|
| 47 |
; Check that imports files are created with -thinlto-emit-imports. |
| 48 |
RUN: not %{command} -thinlto-emit-imports 2>&1 \ |
| 49 |
RUN: | FileCheck %s --check-prefixes=ERR |
| 50 |
RUN: ls | FileCheck %s --check-prefix=IMPORTSFILES |
| 51 |
IMPORTSFILES: 0.bc.imports |
| 52 |
IMPORTSFILES: 1.bc.imports |
| 53 |
|
| 54 |
;--- 0.ll |
| 55 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 56 |
target triple = "x86_64-unknown-linux-gnu" |
| 57 |
|
| 58 |
define void @g() { |
| 59 |
entry: |
| 60 |
ret void |
| 61 |
} |
| 62 |
|
| 63 |
;--- 1.ll |
| 64 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 65 |
target triple = "x86_64-unknown-linux-gnu" |
| 66 |
|
| 67 |
declare void @g(...) |
| 68 |
|
| 69 |
define void @f() { |
| 70 |
entry: |
| 71 |
call void (...) @g() |
| 72 |
ret void |
| 73 |
} |