1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Make IP Constant prop more aggressive about handling self recursive calls.

This implements IPConstantProp/recursion.ll

llvm-svn: 17666
This commit is contained in:
Chris Lattner 2004-11-10 19:43:59 +00:00
parent 30d157de35
commit d920b5b770

View File

@ -81,7 +81,9 @@ bool IPCP::processFunction(Function &F) {
// Check out all of the potentially constant arguments // Check out all of the potentially constant arguments
CallSite::arg_iterator AI = CS.arg_begin(); 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 (*AI == &F) return false; // Passes the function into itself
if (!ArgumentConstants[i].second) { if (!ArgumentConstants[i].second) {
@ -94,7 +96,7 @@ bool IPCP::processFunction(Function &F) {
++NumNonconstant; ++NumNonconstant;
if (NumNonconstant == ArgumentConstants.size()) return false; 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 // This is not a constant argument. Mark the argument as
// non-constant. // non-constant.
ArgumentConstants[i].second = true; ArgumentConstants[i].second = true;