summaryrefslogtreecommitdiff
path: root/test/Transforms/TailCallElim/nocapture.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-11-07 07:10:01 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-11-07 07:10:01 +0000
commit0cade261322242132905914f613d25d16e1a9ff6 (patch)
tree690f1b14afe302ff3888aad76444dacb727d7ecf /test/Transforms/TailCallElim/nocapture.ll
parent6533afe349013821c76f244015cdfb5f189b2aa6 (diff)
downloadllvm-0cade261322242132905914f613d25d16e1a9ff6.tar.gz
llvm-0cade261322242132905914f613d25d16e1a9ff6.tar.bz2
llvm-0cade261322242132905914f613d25d16e1a9ff6.tar.xz
Dust off tail recursion elimination. Fix a fixme by applying CaptureTracking
and add a .ll to demo the new capability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/TailCallElim/nocapture.ll')
-rw-r--r--test/Transforms/TailCallElim/nocapture.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/TailCallElim/nocapture.ll b/test/Transforms/TailCallElim/nocapture.ll
new file mode 100644
index 0000000000..92dc374a93
--- /dev/null
+++ b/test/Transforms/TailCallElim/nocapture.ll
@@ -0,0 +1,24 @@
+; RUN: opt %s -tailcallelim -S | FileCheck %s
+
+declare void @use(i8* nocapture, i8* nocapture)
+
+define i8* @foo(i8* nocapture %A, i1 %cond) {
+; CHECK: tailrecurse:
+; CHECK: %A.tr = phi i8* [ %A, %0 ], [ %B, %cond_true ]
+; CHECK: %cond.tr = phi i1 [ %cond, %0 ], [ false, %cond_true ]
+ %B = alloca i8
+; CHECK: %B = alloca i8
+ br i1 %cond, label %cond_true, label %cond_false
+; CHECK: br i1 %cond.tr, label %cond_true, label %cond_false
+cond_true:
+; CHECK: cond_true:
+; CHECK: br label %tailrecurse
+ call i8* @foo(i8* %B, i1 false)
+ ret i8* null
+cond_false:
+; CHECK: cond_false
+ call void @use(i8* %A, i8* %B)
+; CHECK: tail call void @use(i8* %A.tr, i8* %B)
+ ret i8* null
+; CHECK: ret i8* null
+}