/// Replace all uses of an instruction (specified by BI) with a value, then
/// remove and delete the original instruction.
-void ReplaceInstWithValue(BasicBlock::InstListType &BIL,
- BasicBlock::iterator &BI, Value *V);
+void ReplaceInstWithValue(BasicBlock::iterator &BI, Value *V);
/// Replace the instruction specified by BI with the instruction specified by I.
/// Copies DebugLoc from BI to I, if I doesn't already have a DebugLoc. The
return MadeChanges;
}
-void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL,
- BasicBlock::iterator &BI, Value *V) {
+void llvm::ReplaceInstWithValue(BasicBlock::iterator &BI, Value *V) {
Instruction &I = *BI;
// Replaces all of the uses of the instruction with uses of the value
I.replaceAllUsesWith(V);
V->takeName(&I);
// Delete the unnecessary instruction now...
- BI = BIL.erase(BI);
+ BI = BI->eraseFromParent();
}
void llvm::ReplaceInstWithInst(BasicBlock *BB, BasicBlock::iterator &BI,
BasicBlock::iterator New = I->insertAt(BB, BI);
// Replace all uses of the old instruction, and delete it.
- ReplaceInstWithValue(BB->getInstList(), BI, I);
+ ReplaceInstWithValue(BI, I);
// Move BI back to point to the newly inserted instruction
BI = New;