diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-10 19:43:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-10 19:43:59 +0000 |
commit | ff1529b6cf3b4babad13a39587a20f41b4b46577 (patch) | |
tree | 3bb2a2334e01204a1d526adaa1db8097f3138ec7 /lib/Transforms | |
parent | 62850160149a29a1d1dd53dc7deb096a95672f7d (diff) |
Make IP Constant prop more aggressive about handling self recursive calls.
This implements IPConstantProp/recursion.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17666 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/IPConstantPropagation.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index a1e09e6bef..479f8e73cc 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -81,7 +81,9 @@ bool IPCP::processFunction(Function &F) { // Check out all of the potentially constant arguments CallSite::arg_iterator AI = CS.arg_begin(); - for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) { + Function::aiterator Arg = F.abegin(); + for (unsigned i = 0, e = ArgumentConstants.size(); i != e; + ++i, ++AI, ++Arg) { if (*AI == &F) return false; // Passes the function into itself if (!ArgumentConstants[i].second) { @@ -94,7 +96,7 @@ bool IPCP::processFunction(Function &F) { ++NumNonconstant; if (NumNonconstant == ArgumentConstants.size()) return false; } - } else { + } else if (*AI != &*Arg) { // Ignore recursive calls with same arg // This is not a constant argument. Mark the argument as // non-constant. ArgumentConstants[i].second = true; |