| 1 |
; Test DTLTO output with llvm-lto2. |
| 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 |
; Generate fake object files for mock.py to return. |
| 10 |
RUN: touch t1.o t2.o |
| 11 |
|
| 12 |
; Create an empty subdirectory to avoid having to account for the input files. |
| 13 |
RUN: mkdir %t/out && cd %t/out |
| 14 |
|
| 15 |
; Define a substitution to share the common DTLTO arguments. |
| 16 |
DEFINE: %{command} = llvm-lto2 run ../t1.bc ../t2.bc -o t.o \ |
| 17 |
DEFINE: -dtlto-distributor=%python \ |
| 18 |
DEFINE: -dtlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py,../t1.o,../t2.o \ |
| 19 |
DEFINE: -r=../t1.bc,t1,px \ |
| 20 |
DEFINE: -r=../t2.bc,t2,px |
| 21 |
|
| 22 |
; Perform DTLTO. mock.py does not do any compilation, instead it simply writes |
| 23 |
; the contents of the object files supplied on the command line into the |
| 24 |
; output object files in job order. |
| 25 |
RUN: %{command} |
| 26 |
|
| 27 |
; Check that the expected output files have been created. |
| 28 |
RUN: ls | count 2 |
| 29 |
RUN: ls | FileCheck %s --check-prefix=THINLTO |
| 30 |
|
| 31 |
; llvm-lto2 ThinLTO output files. |
| 32 |
THINLTO-DAG: {{^}}t.o.1{{$}} |
| 33 |
THINLTO-DAG: {{^}}t.o.2{{$}} |
| 34 |
|
| 35 |
RUN: cd .. && rm -rf %t/out && mkdir %t/out && cd %t/out |
| 36 |
|
| 37 |
; Perform DTLTO with --save-temps. |
| 38 |
RUN: %{command} --save-temps |
| 39 |
|
| 40 |
; Check that the expected output files have been created. |
| 41 |
RUN: ls | count 12 |
| 42 |
RUN: ls | FileCheck %s --check-prefixes=THINLTO,SAVETEMPS |
| 43 |
|
| 44 |
; Common -save-temps files from llvm-lto2. |
| 45 |
SAVETEMPS-DAG: {{^}}t.o.resolution.txt{{$}} |
| 46 |
SAVETEMPS-DAG: {{^}}t.o.index.bc{{$}} |
| 47 |
SAVETEMPS-DAG: {{^}}t.o.index.dot{{$}} |
| 48 |
|
| 49 |
; -save-temps incremental files. |
| 50 |
SAVETEMPS-DAG: {{^}}t.o.0.0.preopt.bc{{$}} |
| 51 |
SAVETEMPS-DAG: {{^}}t.o.0.2.internalize.bc{{$}} |
| 52 |
|
| 53 |
; A jobs description JSON. |
| 54 |
SAVETEMPS-DAG: {{^}}t.[[#]].dist-file.json{{$}} |
| 55 |
|
| 56 |
; Summary shards emitted for DTLTO. |
| 57 |
SAVETEMPS-DAG: {{^}}t1.1.[[#]].native.o.thinlto.bc{{$}} |
| 58 |
SAVETEMPS-DAG: {{^}}t2.2.[[#]].native.o.thinlto.bc{{$}} |
| 59 |
|
| 60 |
; DTLTO native output files (the results of the external backend compilations). |
| 61 |
SAVETEMPS-DAG: {{^}}t1.1.[[#]].native.o{{$}} |
| 62 |
SAVETEMPS-DAG: {{^}}t2.2.[[#]].native.o{{$}} |
| 63 |
|
| 64 |
;--- t1.ll |
| 65 |
|
| 66 |
target triple = "x86_64-unknown-linux-gnu" |
| 67 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 68 |
|
| 69 |
define void @t1() { |
| 70 |
ret void |
| 71 |
} |
| 72 |
|
| 73 |
;--- t2.ll |
| 74 |
|
| 75 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 76 |
target triple = "x86_64-unknown-linux-gnu" |
| 77 |
|
| 78 |
define void @t2() { |
| 79 |
ret void |
| 80 |
} |