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

Dan Gohman gohman at apple.com
Thu Jun 19 10:47:47 PDT 2008


Author: djg
Date: Thu Jun 19 12:47:47 2008
New Revision: 52498

URL: http://llvm.org/viewvc/llvm-project?rev=52498&view=rev
Log:
Use Instruction::moveBefore instead of manipulating the instruction list
directly.

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=52498&r1=52497&r2=52498&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Jun 19 12:47:47 2008
@@ -1672,9 +1672,8 @@
       }
       Root.replaceAllUsesWith(TmpLHSI);          // Users now use TmpLHSI
       TmpLHSI->setOperand(1, &Root);             // TmpLHSI now uses the root
-      TmpLHSI->getParent()->getInstList().remove(TmpLHSI);
       BasicBlock::iterator ARI = &Root; ++ARI;
-      BB->getInstList().insert(ARI, TmpLHSI);    // Move TmpLHSI to after Root
+      TmpLHSI->moveBefore(ARI);                  // Move TmpLHSI to after Root
       ARI = Root;
 
       // Now propagate the ExtraOperand down the chain of instructions until we
@@ -1683,8 +1682,7 @@
         Instruction *NextLHSI = cast<Instruction>(TmpLHSI->getOperand(0));
         // Move the instruction to immediately before the chain we are
         // constructing to avoid breaking dominance properties.
-        NextLHSI->getParent()->getInstList().remove(NextLHSI);
-        BB->getInstList().insert(ARI, NextLHSI);
+        NextLHSI->moveBefore(ARI);
         ARI = NextLHSI;
 
         Value *NextOp = NextLHSI->getOperand(1);





More information about the llvm-commits mailing list