| 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 with caching enabled. |
| 16 |
DEFINE: %{command} = llvm-lto2 run ../t1.bc ../t2.bc -o t.o -cache-dir cache-dir \ |
| 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 out of process ThinLTO (DTLTO). |
| 23 |
; Note: mock.py does not do any compilation, instead it simply writes |
| 24 |
; the contents of the object files supplied on the command line into the |
| 25 |
; output object files in job order. |
| 26 |
RUN: %{command} |
| 27 |
|
| 28 |
; Check that the expected output files have been created. |
| 29 |
RUN: ls | count 3 |
| 30 |
; Check that two native object files has been created |
| 31 |
RUN: ls | FileCheck %s --check-prefix=THINLTO |
| 32 |
; Check that DTLTO cache directory has been created |
| 33 |
RUN: ls cache-dir/* | count 2 |
| 34 |
; Check that 2 cache entries are created |
| 35 |
RUN: ls cache-dir/llvmcache-* | count 2 |
| 36 |
|
| 37 |
; llvm-lto2 ThinLTO output files. |
| 38 |
THINLTO-DAG: {{^}}t.o.1{{$}} |
| 39 |
THINLTO-DAG: {{^}}t.o.2{{$}} |
| 40 |
|
| 41 |
# Execute llvm-lto2 again and check that a fully populated cache is used correctly, |
| 42 |
# i.e., no additional cache entries are created for cache hits. |
| 43 |
|
| 44 |
RUN: %{command} |
| 45 |
|
| 46 |
RUN: ls | count 3 |
| 47 |
RUN: ls | FileCheck %s --check-prefix=THINLTO |
| 48 |
RUN: ls cache-dir/* | count 2 |
| 49 |
RUN: ls cache-dir/llvmcache-* | count 2 |
| 50 |
|
| 51 |
;--- t1.ll |
| 52 |
|
| 53 |
target triple = "x86_64-unknown-linux-gnu" |
| 54 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 55 |
|
| 56 |
define void @t1() { |
| 57 |
ret void |
| 58 |
} |
| 59 |
|
| 60 |
;--- t2.ll |
| 61 |
|
| 62 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 63 |
target triple = "x86_64-unknown-linux-gnu" |
| 64 |
|
| 65 |
define void @t2() { |
| 66 |
ret void |
| 67 |
} |