[llvm-commits] [llvm] r72371 - in /llvm/trunk/lib: Analysis/ScalarEvolutionExpander.cpp Transforms/Scalar/IndVarSimplify.cpp

Torok Edwin edwintorok at gmail.com
Sun May 24 12:36:09 PDT 2009


Author: edwin
Date: Sun May 24 14:36:09 2009
New Revision: 72371

URL: http://llvm.org/viewvc/llvm-project?rev=72371&view=rev
Log:
Instead of clearing the rewriter, don't attempt to rewrite dead phi nodes.
Also fix 80 column violation.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=72371&r1=72370&r2=72371&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Sun May 24 14:36:09 2009
@@ -615,7 +615,8 @@
 
 Value *SCEVExpander::expand(const SCEV *S) {
   // Check to see if we already expanded this.
-  std::map<SCEVHandle, AssertingVH<Value> >::iterator I = InsertedExpressions.find(S);
+  std::map<SCEVHandle, AssertingVH<Value> >::iterator I =
+    InsertedExpressions.find(S);
   if (I != InsertedExpressions.end())
     return I->second;
   

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sun May 24 14:36:09 2009
@@ -250,7 +250,8 @@
     // Iterate over all of the PHI nodes.
     BasicBlock::iterator BBI = ExitBB->begin();
     while ((PN = dyn_cast<PHINode>(BBI++))) {
-
+      if (PN->use_empty())
+        continue; // dead use, don't replace it
       // Iterate over all of the values in all the PHI nodes.
       for (unsigned i = 0; i != NumPreds; ++i) {
         // If the value being merged in is not integer or is not defined
@@ -303,7 +304,6 @@
         // in the loop, so we don't need an LCSSA phi node anymore.
         if (NumPreds == 1) {
           PN->replaceAllUsesWith(ExitVal);
-          Rewriter.clear();
           RecursivelyDeleteTriviallyDeadInstructions(PN);
           break;
         }





More information about the llvm-commits mailing list