[llvm-commits] [llvm] r112594 - /llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

Owen Anderson resistor at mac.com
Tue Aug 31 00:55:56 PDT 2010


Author: resistor
Date: Tue Aug 31 02:55:56 2010
New Revision: 112594

URL: http://llvm.org/viewvc/llvm-project?rev=112594&view=rev
Log:
Don't perform an extra traversal of the function just to do cleanup.  We can safely simplify instructions after each block has been processed without worrying about iterator invalidation.

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

Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=112594&r1=112593&r2=112594&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Tue Aug 31 02:55:56 2010
@@ -102,7 +102,7 @@
   
   bool Changed = false;
   
-  for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
+  for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {
     for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ) {
       Instruction *II = BI++;
       if (SelectInst *SI = dyn_cast<SelectInst>(II))
@@ -110,10 +110,9 @@
       else if (PHINode *P = dyn_cast<PHINode>(II))
         Changed |= processPHI(P);
     }
-  
-  if (Changed)
-    for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
-      SimplifyInstructionsInBlock(FI);
+    
+    SimplifyInstructionsInBlock(FI);
+  }
   
   return Changed;
 }





More information about the llvm-commits mailing list