diff options
author | Duncan Sands <baldrick@free.fr> | 2010-07-13 15:41:41 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-07-13 15:41:41 +0000 |
commit | d0d3ccc827de69de3d9f666aa922f5f191219a06 (patch) | |
tree | 8925c7ed2232d06bd3179beb3cf67c55fc4e1297 /test | |
parent | 63d024fc9a4f89987fa2cf7ab466ea17ec78ed14 (diff) | |
download | llvm-d0d3ccc827de69de3d9f666aa922f5f191219a06.tar.gz llvm-d0d3ccc827de69de3d9f666aa922f5f191219a06.tar.bz2 llvm-d0d3ccc827de69de3d9f666aa922f5f191219a06.tar.xz |
Handle the case of a tail recursion in which the tail call is followed
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant. This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll b/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll index f39476f7da..06265926fa 100644 --- a/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll +++ b/test/Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll @@ -1,7 +1,9 @@ ; RUN: opt < %s -tailcallelim -S | FileCheck %s ; PR7328 +; PR7506 define i32 @foo(i32 %x) { ; CHECK: define i32 @foo +; CHECK: %accumulator.tr = phi i32 [ 1, %entry ], [ 0, %body ] entry: %cond = icmp ugt i32 %x, 0 ; <i1> [#uses=1] br i1 %cond, label %return, label %body @@ -9,8 +11,9 @@ entry: body: ; preds = %entry %y = add i32 %x, 1 ; <i32> [#uses=1] %tmp = call i32 @foo(i32 %y) ; <i32> [#uses=0] +; CHECK-NOT: call ret i32 0 -; CHECK: ret i32 0 +; CHECK: ret i32 %accumulator.tr return: ; preds = %entry ret i32 1 |