[llvm-commits] [llvm] r60330 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner sabre at nondot.org
Sun Nov 30 22:14:28 PST 2008


Author: lattner
Date: Mon Dec  1 00:14:28 2008
New Revision: 60330

URL: http://llvm.org/viewvc/llvm-project?rev=60330&view=rev
Log:
DeleteTriviallyDeadInstructions is always passed the
DeadInsts ivar, just use it directly.

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Dec  1 00:14:28 2008
@@ -205,7 +205,7 @@
     void StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
                                       IVUsersOfOneStride &Uses,
                                       Loop *L, bool isOnlyStride);
-    void DeleteTriviallyDeadInstructions(SetVector<Instruction*> &Insts);
+    void DeleteTriviallyDeadInstructions();
   };
 }
 
@@ -238,11 +238,10 @@
 /// DeleteTriviallyDeadInstructions - If any of the instructions is the
 /// specified set are trivially dead, delete them and see if this makes any of
 /// their operands subsequently dead.
-void LoopStrengthReduce::
-DeleteTriviallyDeadInstructions(SetVector<Instruction*> &Insts) {
-  while (!Insts.empty()) {
-    Instruction *I = Insts.back();
-    Insts.pop_back();
+void LoopStrengthReduce::DeleteTriviallyDeadInstructions() {
+  while (!DeadInsts.empty()) {
+    Instruction *I = DeadInsts.back();
+    DeadInsts.pop_back();
 
     if (!isInstructionTriviallyDead(I))
       continue;
@@ -253,7 +252,7 @@
       if (Instruction *U = dyn_cast<Instruction>(*i)) {
         *i = 0;
         if (U->use_empty())
-          Insts.insert(U);
+          DeadInsts.insert(U);
       }
     }
     
@@ -1441,7 +1440,7 @@
                                           Rewriter, L, this,
                                           DeadInsts);
 
-      // Mark old value we replaced as possibly dead, so that it is elminated
+      // Mark old value we replaced as possibly dead, so that it is eliminated
       // if we just replaced the last use of that value.
       DeadInsts.insert(cast<Instruction>(User.OperandValToReplace));
 
@@ -2055,7 +2054,7 @@
 
   // Clean up after ourselves
   if (!DeadInsts.empty()) {
-    DeleteTriviallyDeadInstructions(DeadInsts);
+    DeleteTriviallyDeadInstructions();
 
     BasicBlock::iterator I = L->getHeader()->begin();
     while (PHINode *PN = dyn_cast<PHINode>(I++)) {
@@ -2091,7 +2090,7 @@
           break;
       }
     }
-    DeleteTriviallyDeadInstructions(DeadInsts);
+    DeleteTriviallyDeadInstructions();
   }
   return Changed;
 }





More information about the llvm-commits mailing list