Use the new 'moveBefore' method to simplify some code. Really, which is

easier to understand?  :)

llvm-svn: 22706
This commit is contained in:
Chris Lattner 2005-08-08 19:11:57 +00:00
parent d380d8412d
commit 9f269e40c9
3 changed files with 4 additions and 6 deletions

View 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;
}

View 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);

View 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.