llvm.org GIT mirror llvm / be0ad75
llvm-lto2: Move the LTO::run() action behind a subcommand. Move LTO::run() to a "run" subcommand so that we can introduce new subcommands for testing different parts of the LTO implementation. This doesn't use llvm::cl subcommands because it doesn't appear to be currently possible to pass an argument not associated with a subcommand to a subcommand (e.g. -lto-use-new-pm, -mcpu=yonah). Differential Revision: https://reviews.llvm.org/D31410 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299967 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 3 years ago
36 changed file(s) with 109 addition(s) and 88 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as %s -o %t1.o
11 ; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
2 ; RUN: llvm-lto2 -o %t3.o %t2.o %t1.o -r %t2.o,a,px -r %t1.o,a, -r %t1.o,b,px -save-temps
2 ; RUN: llvm-lto2 run -o %t3.o %t2.o %t1.o -r %t2.o,a,px -r %t1.o,a, -r %t1.o,b,px -save-temps
33 ; RUN: llvm-dis < %t3.o.0.0.preopt.bc -o - | FileCheck %s
44 ; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt
55
11 ;
22 ; RUN: llvm-as < %s > %t1.bc
33 ;
4 ; RUN: llvm-lto2 -filetype=asm -r %t1.bc,main,px -o %t2 %t1.bc
4 ; RUN: llvm-lto2 run -filetype=asm -r %t1.bc,main,px -o %t2 %t1.bc
55 ; RUN: FileCheck --check-prefix=ASM %s < %t2.0
6 ; RUN: llvm-lto2 -filetype=obj -r %t1.bc,main,px -o %t2 %t1.bc
6 ; RUN: llvm-lto2 run -filetype=obj -r %t1.bc,main,px -o %t2 %t1.bc
77 ; RUN: llvm-objdump -d %t2.0 | FileCheck --check-prefix=ASM %s
88 ;
99 ; ASM: main:
0 ; RUN: llvm-as %s -o %t.o
11 ; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
2 ; RUN: llvm-lto2 -save-temps -o %t3.o %t.o %t2.o \
2 ; RUN: llvm-lto2 run -save-temps -o %t3.o %t.o %t2.o \
33 ; RUN: -r=%t.o,f1,plx \
44 ; RUN: -r=%t.o,v1,px \
55 ; RUN: -r=%t.o,r11,px \
33 ; Test that the common merging (size + alignment) is properly handled
44
55 ; Client marked the "large with little alignment" one as prevailing
6 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
6 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
77 ; RUN: -r %t1.bc,v,x \
88 ; RUN: -r %t2.bc,v,px \
99 ; RUN: -r %t1.bc,foo,px \
1111 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED
1212
1313 ; Same as before, but reversing the order of the inputs
14 ; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
14 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \
1515 ; RUN: -r %t1.bc,v,x \
1616 ; RUN: -r %t2.bc,v,px \
1717 ; RUN: -r %t1.bc,foo,px \
1919 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED
2020
2121 ; Client marked the "small with large alignment" one as prevailing
22 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
22 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
2323 ; RUN: -r %t1.bc,v,px \
2424 ; RUN: -r %t2.bc,v,x \
2525 ; RUN: -r %t1.bc,foo,px \
2727 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=SMALL-PREVAILED
2828
2929 ; Same as before, but reversing the order of the inputs
30 ; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
30 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \
3131 ; RUN: -r %t1.bc,v,px \
3232 ; RUN: -r %t2.bc,v,x \
3333 ; RUN: -r %t1.bc,foo,px \
3636
3737
3838 ; Client didn't mark any as prevailing, we keep the first one we see as "external"
39 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
39 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
4040 ; RUN: -r %t1.bc,v,x \
4141 ; RUN: -r %t2.bc,v,x \
4242 ; RUN: -r %t1.bc,foo,px \
4444 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=NONE-PREVAILED1
4545
4646 ; Same as before, but reversing the order of the inputs
47 ; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
47 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \
4848 ; RUN: -r %t1.bc,v,x \
4949 ; RUN: -r %t2.bc,v,x \
5050 ; RUN: -r %t1.bc,foo,px \
5454
5555
5656 ; Client marked both as prevailing
57 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
57 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
5858 ; RUN: -r %t1.bc,v,px \
5959 ; RUN: -r %t2.bc,v,px \
6060 ; RUN: -r %t1.bc,foo,px \
6262 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED1
6363
6464 ; Same as before, but reversing the order of the inputs
65 ; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
65 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \
6666 ; RUN: -r %t1.bc,v,px \
6767 ; RUN: -r %t2.bc,v,px \
6868 ; RUN: -r %t1.bc,foo,px \
0 ; RUN: llvm-as -o %t1.bc %s
11 ; RUN: llvm-as -o %t2.bc %p/Inputs/commons.ll
2 ; RUN: llvm-lto2 %t1.bc -r=%t1.bc,x,l %t2.bc -r=%t2.bc,x,pl -o %t.out -save-temps
2 ; RUN: llvm-lto2 run %t1.bc -r=%t1.bc,x,l %t2.bc -r=%t2.bc,x,pl -o %t.out -save-temps
33 ; RUN: llvm-dis -o - %t.out.0.0.preopt.bc | FileCheck %s
44
55 ; A strong definition should override the common
0 ; RUN: llvm-as < %s >%t.bc
11
22 ; RUN: rm -f %t.yaml
3 ; RUN: llvm-lto2 -pass-remarks-output=%t.yaml \
3 ; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
44 ; RUN: -pass-remarks-with-hotness \
55 ; RUN: -r %t.bc,tinkywinky,p \
66 ; RUN: -r %t.bc,patatino,px \
0 ; RUN: llvm-as < %s >%t.bc
11
22 ; RUN: rm -f %t.yaml
3 ; RUN: llvm-lto2 -pass-remarks-output=%t.yaml \
3 ; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
44 ; RUN: -r %t.bc,tinkywinky,p \
55 ; RUN: -r %t.bc,patatino,px \
66 ; RUN: -r %t.bc,main,px -o %t.o %t.bc
0 RUN: llvm-cat -o %t.o
1 RUN: not llvm-lto2 -o %t2 %t.o 2>&1 | FileCheck %s
1 RUN: not llvm-lto2 run -o %t2 %t.o 2>&1 | FileCheck %s
22 CHECK: Bitcode file does not contain any modules
0 ; RUN: llvm-as %s -o %t1.o
11 ; RUN: llvm-as %p/Inputs/intrinsic.ll -o %t2.o
2 ; RUN: llvm-lto2 -o %t3.o %t1.o %t2.o -r %t1.o,foo
2 ; RUN: llvm-lto2 run -o %t3.o %t1.o %t2.o -r %t1.o,foo
33
44 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
55 target triple = "x86_64-unknown-linux-gnu"
44 ; RUN: llvm-as %S/Inputs/link-odr-availextern-ae.ll -o %t2ae
55 ; RUN: llvm-as %S/Inputs/link-odr-availextern-odr.ll -o %t2odr
66
7 ; RUN: llvm-lto2 -o %t3 %t1 %t2ae -r %t1,f,p -r %t2ae,f, -save-temps
7 ; RUN: llvm-lto2 run -o %t3 %t1 %t2ae -r %t1,f,p -r %t2ae,f, -save-temps
88 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=PREVAILING %s
99
10 ; RUN: llvm-lto2 -o %t3 %t1 %t2odr -r %t1,f,p -r %t2odr,f, -save-temps
10 ; RUN: llvm-lto2 run -o %t3 %t1 %t2odr -r %t1,f,p -r %t2odr,f, -save-temps
1111 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=PREVAILING %s
1212
13 ; RUN: llvm-lto2 -o %t3 %t2ae %t1 -r %t1,f,p -r %t2ae,f, -save-temps
13 ; RUN: llvm-lto2 run -o %t3 %t2ae %t1 -r %t1,f,p -r %t2ae,f, -save-temps
1414 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=PREVAILING %s
1515
16 ; RUN: llvm-lto2 -o %t3 %t2odr %t1 -r %t1,f,p -r %t2odr,f, -save-temps
16 ; RUN: llvm-lto2 run -o %t3 %t2odr %t1 -r %t1,f,p -r %t2odr,f, -save-temps
1717 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=PREVAILING %s
1818
19 ; RUN: llvm-lto2 -o %t3 %t2ae -r %t2ae,f, -save-temps
19 ; RUN: llvm-lto2 run -o %t3 %t2ae -r %t2ae,f, -save-temps
2020 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=NONPREVAILING %s
2121
22 ; RUN: llvm-lto2 -o %t3 %t2odr -r %t2odr,f, -save-temps
22 ; RUN: llvm-lto2 run -o %t3 %t2odr -r %t2odr,f, -save-temps
2323 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=NONPREVAILING %s
2424
25 ; RUN: llvm-lto2 -o %t3 %t2odr %t1 -r %t1,f, -r %t2odr,f, -save-temps
25 ; RUN: llvm-lto2 run -o %t3 %t2odr %t1 -r %t1,f, -r %t2odr,f, -save-temps
2626 ; RUN: llvm-dis < %t3.0.0.preopt.bc -o - | FileCheck --check-prefix=NONPREVAILING %s
2727
2828 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
0 ; RUN: opt -thinlto-bc -o %t %s
1 ; RUN: llvm-lto2 -r %t,f,plx -r %t,foo,lx -r %t,foo,plx -o %t1 %t
1 ; RUN: llvm-lto2 run -r %t,f,plx -r %t,foo,lx -r %t,foo,plx -o %t1 %t
22 ; RUN: llvm-nm %t1.0 | FileCheck --check-prefix=MERGED %s
33 ; RUN: llvm-nm %t1.1 | FileCheck %s
44
11 ; RUN: opt %s -o %t1.o
22 ; RUN: opt -module-summary %p/Inputs/mixed_lto.ll -o %t2.o
33
4 ; RUN: llvm-lto2 -o %t3.o %t2.o %t1.o -r %t2.o,main,px -r %t2.o,g, -r %t1.o,g,px
4 ; RUN: llvm-lto2 run -o %t3.o %t2.o %t1.o -r %t2.o,main,px -r %t2.o,g, -r %t1.o,g,px
55
66 ; Task 0 is the regular LTO file (this file)
77 ; RUN: llvm-nm %t3.o.0 | FileCheck %s --check-prefix=NM0
1414
1515 ; Do the same test again, but with the regular and thin LTO modules in the same file.
1616 ; RUN: llvm-cat -b -o %t4.o %t2.o %t1.o
17 ; RUN: llvm-lto2 -o %t5.o %t4.o -r %t4.o,main,px -r %t4.o,g, -r %t4.o,g,px
17 ; RUN: llvm-lto2 run -o %t5.o %t4.o -r %t4.o,main,px -r %t4.o,g, -r %t4.o,g,px
1818 ; RUN: llvm-nm %t5.o.0 | FileCheck %s --check-prefix=NM0
1919 ; RUN: llvm-nm %t5.o.1 | FileCheck %s --check-prefix=NM1
2020
0 ; RUN: opt -module-summary %s -o %t.o
11 ; RUN: llvm-cat -b -o %t2.o %t.o %t.o
2 ; RUN: not llvm-lto2 -o %t3.o %t2.o 2>&1 | FileCheck %s
2 ; RUN: not llvm-lto2 run -o %t3.o %t2.o 2>&1 | FileCheck %s
33 ; CHECK: Expected at most one ThinLTO module per bitcode file
44
55 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
0 ; RUN: llvm-as < %s >%t1
11 ; RUN: llvm-lto -exported-symbol=io_cancel_0_4 -exported-symbol=io_cancel_weak_0_4 -exported-symbol=foo -o %t2 %t1
22 ; RUN: llvm-nm %t2 | FileCheck %s
3 ; RUN: llvm-lto2 -r %t1,io_cancel_0_4,plx -r %t1,io_cancel_0_4,plx -r %t1,io_cancel_local_0_4,plx -r %t1,io_cancel_weak_0_4,plx -r %t1,io_cancel_weak_0_4,plx -r %t1,io_cancel@@LIBAIO_0.4,plx -r %t1,io_cancel_weak@@LIBAIO_0.4,plx -r %t1,io_cancel_weak@@LIBAIO_0.4.1,plx -r %t1,foo,plx -r %t1,foo,plx -r %t1,foo@@VER1,plx -o %t3 %t1 -save-temps
3 ; RUN: llvm-lto2 run -r %t1,io_cancel_0_4,plx -r %t1,io_cancel_0_4,plx -r %t1,io_cancel_local_0_4,plx -r %t1,io_cancel_weak_0_4,plx -r %t1,io_cancel_weak_0_4,plx -r %t1,io_cancel@@LIBAIO_0.4,plx -r %t1,io_cancel_weak@@LIBAIO_0.4,plx -r %t1,io_cancel_weak@@LIBAIO_0.4.1,plx -r %t1,foo,plx -r %t1,foo,plx -r %t1,foo@@VER1,plx -o %t3 %t1 -save-temps
44 ; RUN: llvm-nm %t3.0 | FileCheck %s
55 ; RUN: llvm-dis %t3.0.2.internalize.bc -o - | FileCheck %s --check-prefix=INTERN
66
55 ; RUN: llvm-as < %s >%t1
66 ; RUN: llvm-lto -o %t2 %t1
77 ; RUN: llvm-nm %t2 | FileCheck %s
8 ; RUN: llvm-lto2 -r %t1,_start,plx -r %t1,_start3,plx -r %t1,foo@@SOME_VERSION -r %t1,foo@SOME_VERSION3 -o %t3 %t1 -save-temps
8 ; RUN: llvm-lto2 run -r %t1,_start,plx -r %t1,_start3,plx -r %t1,foo@@SOME_VERSION -r %t1,foo@SOME_VERSION3 -o %t3 %t1 -save-temps
99 ; RUN: llvm-nm %t3.0 | FileCheck %s
1010
1111 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
0 ; RUN: rm -rf %t.cache
11 ; RUN: opt -module-hash -module-summary %s -o %t.bc
22
3 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx
4 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mcpu=yonah
5 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -relax-elf-relocations
6 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -function-sections
7 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -data-sections
8 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -debugger-tune=sce
9 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mattr=+sse2
10 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -relocation-model=static
11 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -code-model=large
12 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -cg-opt-level=0
13 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -O1
14 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -opt-pipeline=loweratomic
15 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -aa-pipeline=basic-aa
16 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -override-triple=x86_64-unknown-linux-gnu
17 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
3 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx
4 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mcpu=yonah
5 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -relax-elf-relocations
6 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -function-sections
7 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -data-sections
8 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -debugger-tune=sce
9 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mattr=+sse2
10 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -relocation-model=static
11 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -code-model=large
12 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -cg-opt-level=0
13 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -O1
14 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -opt-pipeline=loweratomic
15 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -aa-pipeline=basic-aa
16 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -override-triple=x86_64-unknown-linux-gnu
17 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
1818 ; RUN: ls %t.cache | count 15
1919
2020 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
66 ; linkonce_odr will be imported from either t1 or t2, whichever comes first).
77
88 ; RUN: rm -rf %t.cache
9 ; RUN: llvm-lto2 -cache-dir %t.cache -o %t.o %t.bc %t1.bc %t2.bc -r=%t.bc,main,plx -r=%t.bc,f1,lx -r=%t.bc,f2,lx -r=%t1.bc,f1,plx -r=%t1.bc,linkonce_odr,plx -r=%t2.bc,f2,plx -r=%t2.bc,linkonce_odr,lx
10 ; RUN: llvm-lto2 -cache-dir %t.cache -o %t.o %t.bc %t2.bc %t1.bc -r=%t.bc,main,plx -r=%t.bc,f1,lx -r=%t.bc,f2,lx -r=%t2.bc,f2,plx -r=%t2.bc,linkonce_odr,plx -r=%t1.bc,f1,plx -r=%t1.bc,linkonce_odr,lx
9 ; RUN: llvm-lto2 run -cache-dir %t.cache -o %t.o %t.bc %t1.bc %t2.bc -r=%t.bc,main,plx -r=%t.bc,f1,lx -r=%t.bc,f2,lx -r=%t1.bc,f1,plx -r=%t1.bc,linkonce_odr,plx -r=%t2.bc,f2,plx -r=%t2.bc,linkonce_odr,lx
10 ; RUN: llvm-lto2 run -cache-dir %t.cache -o %t.o %t.bc %t2.bc %t1.bc -r=%t.bc,main,plx -r=%t.bc,f1,lx -r=%t.bc,f2,lx -r=%t2.bc,f2,plx -r=%t2.bc,linkonce_odr,plx -r=%t1.bc,f1,plx -r=%t1.bc,linkonce_odr,lx
1111 ; RUN: ls %t.cache | count 6
1212
1313 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
88 ; where both t and t-import are sensitive to typeid1's resolution
99 ; so 4 distinct objects in total.
1010 ; RUN: rm -rf %t.cache
11 ; RUN: llvm-lto2 -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
12 ; RUN: llvm-lto2 -o %t.o %t.bc %t-import.bc %t1.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -r=%t1.bc,vt1,plx
11 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
12 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t1.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -r=%t1.bc,vt1,plx
1313 ; RUN: ls %t.cache | count 4
1414
1515 ; Three resolutions for typeid2: Indir, SingleImpl, UniqueRetVal
1616 ; where both t and t-import are sensitive to typeid2's resolution
1717 ; so 6 distinct objects in total.
1818 ; RUN: rm -rf %t.cache
19 ; RUN: llvm-lto2 -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
20 ; RUN: llvm-lto2 -o %t.o %t.bc %t-import.bc %t2.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t2.bc,vt2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
21 ; RUN: llvm-lto2 -o %t.o %t.bc %t-import.bc %t3.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t3.bc,vt2a,plx -r=%t3.bc,vt2b,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
19 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
20 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t2.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t2.bc,vt2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
21 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t3.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t3.bc,vt2a,plx -r=%t3.bc,vt2b,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
2222 ; RUN: ls %t.cache | count 6
2323
2424 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1010
1111 ; Verify that enabling caching is ignoring module without hash with llvm-lto2
1212 ; RUN: rm -Rf %t.cache
13 ; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
13 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
1414 ; RUN: -r=%t2.bc,_main,plx \
1515 ; RUN: -r=%t2.bc,_globalfunc,lx \
1616 ; RUN: -r=%t.bc,_globalfunc,plx
3535
3636 ; Verify that enabling caching is working with llvm-lto2
3737 ; RUN: rm -Rf %t.cache
38 ; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
38 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
3939 ; RUN: -r=%t2.bc,_main,plx \
4040 ; RUN: -r=%t2.bc,_globalfunc,lx \
4141 ; RUN: -r=%t.bc,_globalfunc,plx
77 ; RUN: llvm-lto -exported-symbol=_main -thinlto-action=run %t1.bc %t2.bc
88 ; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=CHECK-NM
99
10 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.out -save-temps \
10 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
1111 ; RUN: -r %t1.bc,_main,plx \
1212 ; RUN: -r %t1.bc,_bar,pl \
1313 ; RUN: -r %t1.bc,_dead_func,pl \
5050 ; In that case there are uses of @dead_func in the regular LTO partition
5151 ; and it shouldn't be internalized.
5252 ; RUN: opt %p/Inputs/deadstrip.ll -o %t3.bc
53 ; RUN: llvm-lto2 %t1.bc %t3.bc -o %t4.out -save-temps \
53 ; RUN: llvm-lto2 run %t1.bc %t3.bc -o %t4.out -save-temps \
5454 ; RUN: -r %t1.bc,_main,plx \
5555 ; RUN: -r %t1.bc,_bar,pl \
5656 ; RUN: -r %t1.bc,_dead_func,pl \
66
77 ; By default, composite types are imported as type declarations
88 ; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s
9 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.out -save-temps \
9 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
1010 ; RUN: -r %t2.bc,main,plx \
1111 ; RUN: -r %t2.bc,foo,l \
1212 ; RUN: -r %t1.bc,foo,pl
1919
2020 ; Ensure that full type definitions of composite types are imported if requested
2121 ; RUN: llvm-lto -import-full-type-definitions -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=FULL
22 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.out -save-temps \
22 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
2323 ; RUN: -import-full-type-definitions \
2424 ; RUN: -r %t2.bc,main,plx \
2525 ; RUN: -r %t2.bc,foo,l \
0 ; RUN: opt -module-summary -o %t1.bc %s
11 ; RUN: opt -module-summary -o %t2.bc %S/Inputs/dicompositetype-unique.ll
22
3 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t --save-temps \
3 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t --save-temps \
44 ; RUN: -r %t1.bc,_foo,lx \
55 ; RUN: -r %t1.bc,_main,plx \
66 ; RUN: -r %t2.bc,_foo,plx
55 ; RUN: opt -thinlto-bc %p/Inputs/distributed_import.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc
66
77 ; First perform the thin link on the normal bitcode file.
8 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
8 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
99 ; RUN: -thinlto-distributed-indexes \
1010 ; RUN: -r=%t1.bc,g, \
1111 ; RUN: -r=%t1.bc,f,px \
2929 ; Next perform the thin link on the minimized bitcode files, and compare dumps
3030 ; of the resulting indexes to the above dumps to ensure they are identical.
3131 ; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc
32 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
32 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
3333 ; RUN: -thinlto-distributed-indexes \
3434 ; RUN: -r=%t1.bc,g, \
3535 ; RUN: -r=%t1.bc,f,px \
2121 ; RUN: rm -f %t1.thinlto.bc %t1.bc.imports
2222 ; RUN: rm -f %t2.thinlto.bc %t2.bc.imports
2323 ; RUN: rm -f %t3.bc.thinlto.bc %t3.bc.imports
24 ; RUN: llvm-lto2 %t1.bc %t2.bc %t3.bc -o %t.o -save-temps \
24 ; RUN: llvm-lto2 run %t1.bc %t2.bc %t3.bc -o %t.o -save-temps \
2525 ; RUN: -thinlto-distributed-indexes \
2626 ; RUN: -r=%t1.bc,g, \
2727 ; RUN: -r=%t1.bc,f,px \
88
99 ; Verify that enabling caching is working with llvm-lto2
1010 ; RUN: rm -Rf %t.cache
11 ; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
11 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
1212 ; RUN: -r=%t2.bc,_main,plx
1313 ; RUN: ls %t.cache | count 2
1414
2525
2626 ; Verify that caching is disabled for module without hash, with llvm-lto2
2727 ; RUN: rm -Rf %t.cache
28 ; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
28 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
2929 ; RUN: -r=%t2.bc,_main,plx
3030 ; RUN: ls %t.cache | count 0
3131
0 ; RUN: opt -module-summary %s -o %t1.bc
1 ; RUN: not llvm-lto2 %t1.bc -o %t.o \
1 ; RUN: not llvm-lto2 run %t1.bc -o %t.o \
22 ; RUN: -r=%t1.bc,_tinkywinky,pxl \
33 ; RUN: -lto-use-new-pm 2>&1 | FileCheck %s
44
11 ; RUN: opt -module-summary %s -o %t1.bc
22 ; RUN: opt -module-summary %p/Inputs/funcimport2.ll -o %t2.bc
33
4 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
4 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
55 ; RUN: -r=%t1.bc,_foo,plx \
66 ; RUN: -r=%t2.bc,_main,plx \
77 ; RUN: -r=%t2.bc,_foo,l
1010
1111 ; We shouldn't do any importing at -O0
1212 ; rm -f %t.o.1.3.import.bc
13 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
13 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
1414 ; RUN: -O0 \
1515 ; RUN: -r=%t1.bc,_foo,plx \
1616 ; RUN: -r=%t2.bc,_main,plx \
22 ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=REGULAR
33 ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - --exported-symbol=foo | llvm-dis -o - | FileCheck %s --check-prefix=INTERNALIZE
44
5 ; RUN: llvm-lto2 %t1.bc -o %t.o -save-temps \
5 ; RUN: llvm-lto2 run %t1.bc -o %t.o -save-temps \
66 ; RUN: -r=%t1.bc,_foo,pxl \
77 ; RUN: -r=%t1.bc,_bar,pl \
88 ; RUN: -r=%t1.bc,_linkonce_func,pl
66 ; RUN: llvm-nm -o - < %t2.bc.thinlto.o | FileCheck %s --check-prefix=NM2
77
88 ; Import with instr limit to ensure only foo imported.
9 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
9 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
1010 ; RUN: -r=%t1.bc,foo,pxl \
1111 ; RUN: -r=%t1.bc,baz,pxl \
1212 ; RUN: -r=%t1.bc,baz.clone,pxl \
77 ; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM0
88 ; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s --check-prefix=NM1
99
10 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
10 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
1111 ; RUN: -r=%t1.bc,foo,plx \
1212 ; RUN: -r=%t1.bc,globalfunc,plx \
1313 ; RUN: -r=%t1.bc,globalfunc,plx \
44 ; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM0
55 ; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s --check-prefix=NM1
66
7 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
7 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
88 ; RUN: -r=%t1.bc,foo,lx \
99 ; RUN: -r=%t1.bc,foo,plx \
1010 ; RUN: -r=%t1.bc,_simplefunction,pl \
0 ; RUN: opt -module-summary %s -o %t1.bc
11 ; RUN: opt -module-summary %p/Inputs/reference_non_importable.ll -o %t2.bc
22
3 ; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
3 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
44 ; RUN: -r=%t1.bc,_foo,pxl \
55 ; RUN: -r=%t1.bc,_b,pxl \
66 ; RUN: -r=%t2.bc,_main,pxl \
0 ; RUN: llvm-as < %s > %t1.bc
11
22 ; Reject input modules without a datalayout.
3 ; RUN: not llvm-lto2 %t1.bc -o %t.o \
3 ; RUN: not llvm-lto2 run %t1.bc -o %t.o \
44 ; RUN: -r %t1.bc,patatino,px 2>&1 | FileCheck %s
55
66 ; CHECK: input module has no datalayout
0 ; RUN: llvm-as < %s > %t1.bc
11
22 ; Try a custom pipeline
3 ; RUN: llvm-lto2 %t1.bc -o %t.o -save-temps \
3 ; RUN: llvm-lto2 run %t1.bc -o %t.o -save-temps \
44 ; RUN: -r %t1.bc,patatino,px -opt-pipeline loweratomic \
55 ; RUN: -aa-pipeline basic-aa
66 ; RUN: llvm-dis < %t.o.0.4.opt.bc | FileCheck %s --check-prefix=CUSTOM
77
88 ; Try the new pass manager LTO default pipeline (make sure the option
99 ; is accepted).
10 ; RUN: llvm-lto2 %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
10 ; RUN: llvm-lto2 run %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
1111
1212 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1313 target triple = "x86_64-unknown-linux-gnu"
2222 ; CUSTOM-NEXT: }
2323
2424 ; Check that invalid pipelines are caught as errors.
25 ; RUN: not llvm-lto2 %t1.bc -o %t.o \
25 ; RUN: not llvm-lto2 run %t1.bc -o %t.o \
2626 ; RUN: -r %t1.bc,patatino,px -opt-pipeline foogoo 2>&1 | \
2727 ; RUN: FileCheck %s --check-prefix=ERR
2828
2929 ; ERR: LLVM ERROR: unable to parse pass pipeline description: foogoo
3030
31 ; RUN: not llvm-lto2 %t1.bc -o %t.o \
31 ; RUN: not llvm-lto2 run %t1.bc -o %t.o \
3232 ; RUN: -r %t1.bc,patatino,px -aa-pipeline patatino \
3333 ; RUN: -opt-pipeline loweratomic 2>&1 | \
3434 ; RUN: FileCheck %s --check-prefix=AAERR
0 ; RUN: llvm-as %s -o %t.bc
1 ; RUN: not llvm-lto2 -o %t2.o %t.bc 2>&1 | FileCheck --check-prefix=ERR1 %s
2 ; RUN: not llvm-lto2 -o %t2.o -r %t.bc,foo,p -r %t.bc,bar,p %t.bc 2>&1 | FileCheck --check-prefix=ERR2 %s
3 ; RUN: not llvm-lto2 -o %t2.o -r %t.bc,foo,q %t.bc 2>&1 | FileCheck --check-prefix=ERR3 %s
4 ; RUN: not llvm-lto2 -o %t2.o -r foo %t.bc 2>&1 | FileCheck --check-prefix=ERR4 %s
1 ; RUN: not llvm-lto2 run -o %t2.o %t.bc 2>&1 | FileCheck --check-prefix=ERR1 %s
2 ; RUN: not llvm-lto2 run -o %t2.o -r %t.bc,foo,p -r %t.bc,bar,p %t.bc 2>&1 | FileCheck --check-prefix=ERR2 %s
3 ; RUN: not llvm-lto2 run -o %t2.o -r %t.bc,foo,q %t.bc 2>&1 | FileCheck --check-prefix=ERR3 %s
4 ; RUN: not llvm-lto2 run -o %t2.o -r foo %t.bc 2>&1 | FileCheck --check-prefix=ERR4 %s
55
66 ; ERR1: missing symbol resolution for {{.*}}.bc,foo
77 ; ERR2: unused symbol resolution for {{.*}}.bc,bar
125125 return T();
126126 }
127127
128 int main(int argc, char **argv) {
129 InitializeAllTargets();
130 InitializeAllTargetMCs();
131 InitializeAllAsmPrinters();
132 InitializeAllAsmParsers();
133
128 static int usage() {
129 errs() << "Available subcommands: run\n";
130 return 1;
131 }
132
133 static int run(int argc, char **argv) {
134134 cl::ParseCommandLineOptions(argc, argv, "Resolution-based LTO test harness");
135135
136136 // FIXME: Workaround PR30396 which means that a symbol can appear
283283 Cache = check(localCache(CacheDir, AddBuffer), "failed to create cache");
284284
285285 check(Lto.run(AddStream, Cache), "LTO::run failed");
286 }
286 return 0;
287 }
288
289 int main(int argc, char **argv) {
290 InitializeAllTargets();
291 InitializeAllTargetMCs();
292 InitializeAllAsmPrinters();
293 InitializeAllAsmParsers();
294
295 // FIXME: This should use llvm::cl subcommands, but it isn't currently
296 // possible to pass an argument not associated with a subcommand to a
297 // subcommand (e.g. -lto-use-new-pm).
298 if (argc < 2)
299 return usage();
300
301 StringRef Subcommand = argv[1];
302 // Ensure that argv[0] is correct after adjusting argv/argc.
303 argv[1] = argv[0];
304 if (Subcommand == "run")
305 return run(argc - 1, argv + 1);
306 return usage();
307 }