summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/TailRecursionElimination.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-04-15 12:46:56 +0000
committerGabor Greif <ggreif@gmail.com>2010-04-15 12:46:56 +0000
commit9ee17208115482441953127615231c59a2f4d052 (patch)
treefea1c2465e14ae8c3d89e0cf07588155acf8a23d /lib/Transforms/Scalar/TailRecursionElimination.cpp
parent45d95a1ad5eb72c65db8cc691a10339aa7c9c024 (diff)
downloadllvm-9ee17208115482441953127615231c59a2f4d052.tar.gz
llvm-9ee17208115482441953127615231c59a2f4d052.tar.bz2
llvm-9ee17208115482441953127615231c59a2f4d052.tar.xz
back out r101364, as it trips the linux nightlybot on some clang C++ tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/TailRecursionElimination.cpp')
-rw-r--r--lib/Transforms/Scalar/TailRecursionElimination.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 667e4d9a95..162d902cfa 100644
--- a/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -250,7 +250,7 @@ static bool isDynamicConstant(Value *V, CallInst *CI, ReturnInst *RI) {
// If we are passing this argument into call as the corresponding
// argument operand, then the argument is dynamically constant.
// Otherwise, we cannot transform this function safely.
- if (CI->getOperand(ArgNo) == Arg)
+ if (CI->getOperand(ArgNo+1) == Arg)
return true;
}
@@ -442,7 +442,7 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry,
// required PHI nodes, add entries into the PHI node for the actual
// parameters passed into the tail-recursive call.
for (unsigned i = 0, e = CI->getNumOperands()-1; i != e; ++i)
- ArgumentPHIs[i]->addIncoming(CI->getOperand(i), BB);
+ ArgumentPHIs[i]->addIncoming(CI->getOperand(i+1), BB);
// If we are introducing an accumulator variable to eliminate the recursion,
// do so now. Note that we _know_ that no subsequent tail recursion