summaryrefslogtreecommitdiffstats
path: root/llvm/test/LTO
diff options
context:
space:
mode:
authorRobert Lougher <rob.lougher@gmail.com>2019-03-19 20:24:28 +0000
committerRobert Lougher <rob.lougher@gmail.com>2019-03-19 20:24:28 +0000
commitde548ccab9f1dfdefff338754fbc151f4b5cee46 (patch)
tree581194c9a51c9647c9d84473a60795218bf1991a /llvm/test/LTO
parent70537abe525cd6499feae5f34e5ae3d107a0f940 (diff)
downloadbcm5719-llvm-de548ccab9f1dfdefff338754fbc151f4b5cee46.tar.gz
bcm5719-llvm-de548ccab9f1dfdefff338754fbc151f4b5cee46.zip
[TailCallElim] Add tailcall elimination pass to LTO pipelines
LTO provides additional opportunities for tailcall elimination due to link-time inlining and visibility of nocapture attribute. Testing showed negligible impact on compilation times. Differential Revision: https://reviews.llvm.org/D58391 llvm-svn: 356511
Diffstat (limited to 'llvm/test/LTO')
-rw-r--r--llvm/test/LTO/X86/tailcallelim.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/LTO/X86/tailcallelim.ll b/llvm/test/LTO/X86/tailcallelim.ll
new file mode 100644
index 00000000000..2c3a9b52fa9
--- /dev/null
+++ b/llvm/test/LTO/X86/tailcallelim.ll
@@ -0,0 +1,22 @@
+; Check that the LTO pipelines add the Tail Call Elimination pass.
+
+; RUN: llvm-as < %s > %t1
+; RUN: llvm-lto -o %t2 %t1 --exported-symbol=foo -save-merged-module
+; RUN: llvm-dis < %t2.merged.bc | FileCheck %s
+
+; RUN: llvm-lto2 run -r %t1,foo,plx -r %t1,bar,plx -o %t3 %t1 -save-temps
+; RUN: llvm-dis < %t3.0.4.opt.bc | FileCheck %s
+
+; RUN: llvm-lto2 run -r %t1,foo,plx -r %t1,bar,plx -o %t4 %t1 -save-temps -use-new-pm
+; RUN: llvm-dis < %t4.0.4.opt.bc | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo() {
+; CHECK: tail call void @bar()
+ call void @bar()
+ ret void
+}
+
+declare void @bar()
OpenPOWER on IntegriCloud