only IPSCCP incoming arguments if the function is executable, this fixes

an assertion on the buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85784 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-11-02 03:25:55 +00:00
parent 36c9952b1b
commit 89112b608f

View File

@ -1713,21 +1713,23 @@ bool IPSCCP::runOnModule(Module &M) {
SmallVector<BasicBlock*, 512> BlocksToErase;
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
AI != E; ++AI) {
if (AI->use_empty()) continue;
if (Solver.isBlockExecutable(F->begin())) {
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
AI != E; ++AI) {
if (AI->use_empty()) continue;
LatticeVal IV = Solver.getLatticeValueFor(AI);
if (IV.isOverdefined()) continue;
LatticeVal IV = Solver.getLatticeValueFor(AI);
if (IV.isOverdefined()) continue;
Constant *CST = IV.isConstant() ?
IV.getConstant() : UndefValue::get(AI->getType());
DEBUG(errs() << "*** Arg " << *AI << " = " << *CST <<"\n");
Constant *CST = IV.isConstant() ?
IV.getConstant() : UndefValue::get(AI->getType());
DEBUG(errs() << "*** Arg " << *AI << " = " << *CST <<"\n");
// Replaces all of the uses of a variable with uses of the
// constant.
AI->replaceAllUsesWith(CST);
++IPNumArgsElimed;
// Replaces all of the uses of a variable with uses of the
// constant.
AI->replaceAllUsesWith(CST);
++IPNumArgsElimed;
}
}
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {