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;
}
// 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));
// 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);
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.