aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BasicBlockUtils.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 871d742..2ee3dbd 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -555,8 +555,8 @@ void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL,
BI = BIL.erase(BI);
}
-void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL,
- BasicBlock::iterator &BI, Instruction *I) {
+void llvm::ReplaceInstWithInst(BasicBlock *BB, BasicBlock::iterator &BI,
+ Instruction *I) {
assert(I->getParent() == nullptr &&
"ReplaceInstWithInst: Instruction already inserted into basic block!");
@@ -566,10 +566,10 @@ void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL,
I->setDebugLoc(BI->getDebugLoc());
// Insert the new instruction into the basic block...
- BasicBlock::iterator New = BIL.insert(BI, I);
+ BasicBlock::iterator New = I->insertAt(BB, BI);
// Replace all uses of the old instruction, and delete it.
- ReplaceInstWithValue(BIL, BI, I);
+ ReplaceInstWithValue(BB->getInstList(), BI, I);
// Move BI back to point to the newly inserted instruction
BI = New;
@@ -591,7 +591,7 @@ bool llvm::IsBlockFollowedByDeoptOrUnreachable(const BasicBlock *BB) {
void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) {
BasicBlock::iterator BI(From);
- ReplaceInstWithInst(From->getParent()->getInstList(), BI, To);
+ ReplaceInstWithInst(From->getParent(), BI, To);
}
BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, DominatorTree *DT,
@@ -1344,12 +1344,12 @@ static void SplitLandingPadPredecessorsImpl(
LandingPadInst *LPad = OrigBB->getLandingPadInst();
Instruction *Clone1 = LPad->clone();
Clone1->setName(Twine("lpad") + Suffix1);
- NewBB1->getInstList().insert(NewBB1->getFirstInsertionPt(), Clone1);
+ Clone1->insertAt(NewBB1, NewBB1->getFirstInsertionPt());
if (NewBB2) {
Instruction *Clone2 = LPad->clone();
Clone2->setName(Twine("lpad") + Suffix2);
- NewBB2->getInstList().insert(NewBB2->getFirstInsertionPt(), Clone2);
+ Clone2->insertAt(NewBB2, NewBB2->getFirstInsertionPt());
// Create a PHI node for the two cloned landingpad instructions only
// if the original landingpad instruction has some uses.
@@ -1400,7 +1400,7 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
Instruction *UncondBranch = Pred->getTerminator();
// Clone the return and add it to the end of the predecessor.
Instruction *NewRet = RI->clone();
- Pred->getInstList().push_back(NewRet);
+ NewRet->insertAt(Pred, Pred->end());
// If the return instruction returns a value, and if the value was a
// PHI node in "BB", propagate the right value into the return.
@@ -1412,7 +1412,7 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
// return instruction.
V = BCI->getOperand(0);
NewBC = BCI->clone();
- Pred->getInstList().insert(NewRet->getIterator(), NewBC);
+ NewBC->insertAt(Pred, NewRet->getIterator());
Op = NewBC;
}
@@ -1422,9 +1422,9 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
NewEV = EVI->clone();
if (NewBC) {
NewBC->setOperand(0, NewEV);
- Pred->getInstList().insert(NewBC->getIterator(), NewEV);
+ NewEV->insertAt(Pred, NewBC->getIterator());
} else {
- Pred->getInstList().insert(NewRet->getIterator(), NewEV);
+ NewEV->insertAt(Pred, NewRet->getIterator());
Op = NewEV;
}
}