[llvm-commits] [llvm] r80562 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sun Aug 30 23:57:37 PDT 2009


Author: lattner
Date: Mon Aug 31 01:57:37 2009
New Revision: 80562

URL: http://llvm.org/viewvc/llvm-project?rev=80562&view=rev
Log:
fix some cases where instcombine would change hte IR but not return true
from runOnFunction

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Aug 31 01:57:37 2009
@@ -164,6 +164,7 @@
       public InstVisitor<InstCombiner, Instruction*> {
     TargetData *TD;
     bool MustPreserveLCSSA;
+    bool MadeIRChange;
   public:
     /// Worklist - All of the instructions that need to be simplified.
     InstCombineWorklist Worklist;
@@ -339,6 +340,7 @@
       }
       Worklist.Remove(&I);
       I.eraseFromParent();
+      MadeIRChange = true;
       return 0;  // Don't do anything with FI
     }
         
@@ -12676,7 +12678,7 @@
 }
 
 bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
-  bool Changed = false;
+  MadeIRChange = false;
   TD = getAnalysisIfAvailable<TargetData>();
   
   DEBUG(errs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on "
@@ -12703,7 +12705,7 @@
           // going to do one without it.
           if (!isa<DbgInfoIntrinsic>(I)) {
             ++NumDeadInst;
-            Changed = true;
+            MadeIRChange = true;
           }
           if (!I->use_empty())
             I->replaceAllUsesWith(UndefValue::get(I->getType()));
@@ -12721,7 +12723,7 @@
       DEBUG(errs() << "IC: DCE: " << *I << '\n');
       EraseInstFromFunction(*I);
       ++NumDeadInst;
-      Changed = true;
+      MadeIRChange = true;
       continue;
     }
 
@@ -12733,7 +12735,7 @@
       ReplaceInstUsesWith(*I, C);
       ++NumConstProp;
       EraseInstFromFunction(*I);
-      Changed = true;
+      MadeIRChange = true;
       continue;
     }
 
@@ -12745,7 +12747,7 @@
                                   F.getContext(), TD))
             if (NewC != CE) {
               i->set(NewC);
-              Changed = true;
+              MadeIRChange = true;
             }
     }
 
@@ -12768,7 +12770,7 @@
         if (UserIsSuccessor && !isa<PHINode>(I->use_back()) &&
             next(pred_begin(UserParent)) == pred_end(UserParent))
           // Okay, the CFG is simple enough, try to sink this instruction.
-          Changed |= TryToSinkInstruction(I, UserParent);
+          MadeIRChange |= TryToSinkInstruction(I, UserParent);
       }
     }
 
@@ -12823,12 +12825,12 @@
           Worklist.AddUsersToWorkList(*I);
         }
       }
-      Changed = true;
+      MadeIRChange = true;
     }
   }
 
   Worklist.Zap();
-  return Changed;
+  return MadeIRChange;
 }
 
 





More information about the llvm-commits mailing list