diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-02 03:25:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-02 03:25:55 +0000 |
commit | e82b087ae69e8e53c9f0f1d47ba41d984af3c384 (patch) | |
tree | 2b1eff78642bc9e3bb088ad4d23fdfdf1027c1db /llvm/lib | |
parent | 9e97fbe11406fc119f1215ad2dc0dd6a76dc89fb (diff) | |
download | bcm5719-llvm-e82b087ae69e8e53c9f0f1d47ba41d984af3c384.tar.gz bcm5719-llvm-e82b087ae69e8e53c9f0f1d47ba41d984af3c384.zip |
only IPSCCP incoming arguments if the function is executable, this fixes
an assertion on the buildbot.
llvm-svn: 85784
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 016d018d73b..5e360d96a59 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -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; - - 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"); - - // Replaces all of the uses of a variable with uses of the - // constant. - AI->replaceAllUsesWith(CST); - ++IPNumArgsElimed; + 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; + + 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; + } } for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |