llvm.org GIT mirror llvm / d1ec87f
Resubmit r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines" Failing LLD tests have been fixed in r356593. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356594 91177308-0d34-0410-b5e6-96231b3b80d8 Robert Lougher 5 months ago
4 changed file(s) with 31 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11841184 // Break up allocas
11851185 FPM.addPass(SROA());
11861186
1187 // LTO provides additional opportunities for tailcall elimination due to
1188 // link-time inlining, and visibility of nocapture attribute.
1189 FPM.addPass(TailCallElimPass());
1190
11871191 // Run a few AA driver optimizations here and now to cleanup the code.
11881192 MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
11891193
895895 // Break up allocas
896896 PM.add(createSROAPass());
897897
898 // LTO provides additional opportunities for tailcall elimination due to
899 // link-time inlining, and visibility of nocapture attribute.
900 PM.add(createTailCallEliminationPass());
901
898902 // Run a few AA driven optimizations here and now, to cleanup the code.
899903 PM.add(createPostOrderFunctionAttrsLegacyPass()); // Add nocapture.
900904 PM.add(createGlobalsAAWrapperPass()); // IP alias analysis.
0 ; Check that the LTO pipelines add the Tail Call Elimination pass.
1
2 ; RUN: llvm-as < %s > %t1
3 ; RUN: llvm-lto -o %t2 %t1 --exported-symbol=foo -save-merged-module
4 ; RUN: llvm-dis < %t2.merged.bc | FileCheck %s
5
6 ; RUN: llvm-lto2 run -r %t1,foo,plx -r %t1,bar,plx -o %t3 %t1 -save-temps
7 ; RUN: llvm-dis < %t3.0.4.opt.bc | FileCheck %s
8
9 ; RUN: llvm-lto2 run -r %t1,foo,plx -r %t1,bar,plx -o %t4 %t1 -save-temps -use-new-pm
10 ; RUN: llvm-dis < %t4.0.4.opt.bc | FileCheck %s
11
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13 target triple = "x86_64-unknown-linux-gnu"
14
15 define void @foo() {
16 ; CHECK: tail call void @bar()
17 call void @bar()
18 ret void
19 }
20
21 declare void @bar()
8080 ; CHECK-O2-NEXT: Running pass: JumpThreadingPass
8181 ; CHECK-O2-NEXT: Running analysis: LazyValueAnalysis
8282 ; CHECK-O2-NEXT: Running pass: SROA on foo
83 ; CHECK-O2-NEXT: Running pass: TailCallElimPass on foo
8384 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
8485 ; CHECK-O2-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}PostOrderFunctionAttrsPass>
8586 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>