Don't perform an extra traversal of the function just to do cleanup. We can safely...
authorOwen Anderson <resistor@mac.com>
Tue, 31 Aug 2010 07:55:56 +0000 (07:55 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 31 Aug 2010 07:55:56 +0000 (07:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112594 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

index 9616b9b6adef8a3a27d68c4207faa445280911f2..a62eb20a88e41bea595ef566f95c1d44de47efd1 100644 (file)
@@ -102,7 +102,7 @@ bool CorrelatedValuePropagation::runOnFunction(Function &F) {
   
   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 @@ bool CorrelatedValuePropagation::runOnFunction(Function &F) {
       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;
 }