aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2023-05-23 10:28:57 +0100
committerMatt Arsenault <Matthew.Arsenault@amd.com>2023-06-02 18:14:28 -0400
commit1536e299e63d7788f38117b0212ca50eb76d7a3b (patch)
tree3e8a95e6e2798f366769d6b817b34cdbe678388d /llvm/lib/IR/BasicBlock.cpp
parent12d967c95f1633bebd1b225ddd53573951a7ca43 (diff)
downloadllvm-1536e299e63d7788f38117b0212ca50eb76d7a3b.zip
llvm-1536e299e63d7788f38117b0212ca50eb76d7a3b.tar.gz
llvm-1536e299e63d7788f38117b0212ca50eb76d7a3b.tar.bz2
InstSimplify: Require instruction be parented
Unlike every other analysis and transform, simplifyInstruction permitted operating on instructions which are not inserted into a function. This created an edge case no other code needs to really worry about, and limited transforms in cases that can make use of the context function. Only the inliner and a handful of other utilities were making use of this, so just fix up these edge cases. Results in some IR ordering differences since cloned blocks are inserted eagerly now. Plus some additional simplifications trigger (e.g. some add 0s now folded out that previously didn't).
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 5e900e6..14e1787 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -133,9 +133,8 @@ iplist<BasicBlock>::iterator BasicBlock::eraseFromParent() {
return getParent()->getBasicBlockList().erase(getIterator());
}
-void BasicBlock::moveBefore(BasicBlock *MovePos) {
- MovePos->getParent()->splice(MovePos->getIterator(), getParent(),
- getIterator());
+void BasicBlock::moveBefore(SymbolTableList<BasicBlock>::iterator MovePos) {
+ getParent()->splice(MovePos, getParent(), getIterator());
}
void BasicBlock::moveAfter(BasicBlock *MovePos) {