Use the new 'moveBefore' method to simplify some code. Really, which is
authorChris Lattner <sabre@nondot.org>
Mon, 8 Aug 2005 19:11:57 +0000 (19:11 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 8 Aug 2005 19:11:57 +0000 (19:11 +0000)
easier to understand?  :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22706 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/Reassociate.cpp
lib/Transforms/Scalar/TailRecursionElimination.cpp

index b9113a4460043075b5141c2c80b307919d5500f7..67dca06a420531ab685f7738a7dfa1c0e83195a4 100644 (file)
@@ -5238,8 +5238,7 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
   BasicBlock::iterator InsertPos = DestBlock->begin();
   while (isa<PHINode>(InsertPos)) ++InsertPos;
 
-  BasicBlock *SrcBlock = I->getParent();
-  DestBlock->getInstList().splice(InsertPos, SrcBlock->getInstList(), I);
+  I->moveBefore(InsertPos);
   ++NumSunkInst;
   return true;
 }
index 1bc6ebe4892d70ac03bae3ad91f85d575ef3a028..c55bce0d7e8cad4f328b567dd1112d83c53309c4 100644 (file)
@@ -184,7 +184,7 @@ void Reassociate::LinearizeExpr(BinaryOperator *I) {
 
   // Move the RHS instruction to live immediately before I, avoiding breaking
   // dominator properties.
-  I->getParent()->getInstList().splice(I, RHS->getParent()->getInstList(), RHS);
+  RHS->moveBefore(I);
 
   // Move operands around to do the linearization.
   I->setOperand(1, RHS->getOperand(0));
@@ -261,8 +261,7 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
 
   // Move LHS right before I to make sure that the tree expression dominates all
   // values.
-  I->getParent()->getInstList().splice(I,
-                                      LHSBO->getParent()->getInstList(), LHSBO);
+  LHSBO->moveBefore(I);
 
   // Linearize the expression tree on the LHS.
   LinearizeExprTree(LHSBO, Ops);
index 2b67b439cb323d21176b39e75925f3e6d1bc5639..a8c2a3a8b770bbbebd1b25a38b27cd94ecb932f6 100644 (file)
@@ -363,7 +363,7 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry,
              NEBI = NewEntry->begin(); OEBI != E; )
         if (AllocaInst *AI = dyn_cast<AllocaInst>(OEBI++))
           if (isa<ConstantInt>(AI->getArraySize()))
-            NewEntry->getInstList().splice(NEBI, OldEntry->getInstList(), AI);
+            AI->moveBefore(NEBI);
 
     // Now that we have created a new block, which jumps to the entry
     // block, insert a PHI node for each argument of the function.