[llvm-commits] [llvm] r85784 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Chris Lattner sabre at nondot.org
Sun Nov 1 19:25:55 PST 2009


Author: lattner
Date: Sun Nov  1 21:25:55 2009
New Revision: 85784

URL: http://llvm.org/viewvc/llvm-project?rev=85784&view=rev
Log:
only IPSCCP incoming arguments if the function is executable, this fixes
an assertion on the buildbot.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=85784&r1=85783&r2=85784&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Sun Nov  1 21:25:55 2009
@@ -1713,21 +1713,23 @@
   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) {





More information about the llvm-commits mailing list