aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorVasileios Porpodas <vporpodas@google.com>2022-11-28 14:53:24 -0800
committerVasileios Porpodas <vporpodas@google.com>2022-12-12 17:47:24 -0800
commitda49083dbf0f5163dfbd37498557a25cdc4345c8 (patch)
tree4a16dcf15633b8073dc85228392e3c6e8e2cf1c5 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parentf7a1f7ab70eadd8264db2d3f956a1a6bab749c01 (diff)
downloadllvm-da49083dbf0f5163dfbd37498557a25cdc4345c8.zip
llvm-da49083dbf0f5163dfbd37498557a25cdc4345c8.tar.gz
llvm-da49083dbf0f5163dfbd37498557a25cdc4345c8.tar.bz2
[NFC] Remove the instruction list from the arguments of llvm::ReplaceInstWithValue().
This is part of a series of cleanup patches towards making BasicBlock::getInstList() private. Differential Revision: https://reviews.llvm.org/D139153
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BasicBlockUtils.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 2ee3dbd..a699540 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -541,8 +541,7 @@ bool llvm::RemoveRedundantDbgInstrs(BasicBlock *BB) {
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);
@@ -552,7 +551,7 @@ void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL,
V->takeName(&I);
// Delete the unnecessary instruction now...
- BI = BIL.erase(BI);
+ BI = BI->eraseFromParent();
}
void llvm::ReplaceInstWithInst(BasicBlock *BB, BasicBlock::iterator &BI,
@@ -569,7 +568,7 @@ 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;