summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorHideto Ueno <uenoku.tokotoko@gmail.com>2019-12-27 02:39:37 +0900
committerHideto Ueno <uenoku.tokotoko@gmail.com>2019-12-27 02:39:37 +0900
commitcb5eb13eafdcf2d6ad8dc3a2c7b25eea3948839d (patch)
treeb75590fe20a7a1911efe4ff3b159b716e5d4799d /llvm/lib/Transforms/IPO
parentffd57408efd4c8d455616a5ff4f623250e8580c9 (diff)
downloadbcm5719-llvm-cb5eb13eafdcf2d6ad8dc3a2c7b25eea3948839d.tar.gz
bcm5719-llvm-cb5eb13eafdcf2d6ad8dc3a2c7b25eea3948839d.zip
[Attributor] Add helper to change an instruction to `unreachable` inst
Summary: Calling `changeToUnreachable` in `manifest` from different places might cause really unpredictable problems. As other deleting functions are doing, we need to change these instructions after all `manifest`. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71910
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index deb11011f8e..65f02a72754 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2049,7 +2049,7 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior {
if (!UBMemAccessInsts.size())
return ChangeStatus::UNCHANGED;
for (Instruction *I : UBMemAccessInsts)
- changeToUnreachable(I, /* UseLLVMTrap */ false);
+ A.changeToUnreachableAfterManifest(I);
return ChangeStatus::CHANGED;
}
@@ -2736,7 +2736,7 @@ struct AAIsDeadFunction : public AAIsDead {
BB = SplitPos->getParent();
SplitBlock(BB, SplitPos);
- changeToUnreachable(BB->getTerminator(), /* UseLLVMTrap */ false);
+ A.changeToUnreachableAfterManifest(BB->getTerminator());
HasChanged = ChangeStatus::CHANGED;
}
@@ -5459,7 +5459,6 @@ ChangeStatus Attributor::run(Module &M) {
SmallVector<Instruction *, 32> DeadInsts;
SmallVector<Instruction *, 32> TerminatorsToFold;
- SmallVector<Instruction *, 32> UnreachablesToInsert;
for (auto &It : ToBeChangedUses) {
Use *U = It.first;
@@ -5476,13 +5475,13 @@ ChangeStatus Attributor::run(Module &M) {
if (isa<Constant>(NewV) && isa<BranchInst>(U->getUser())) {
Instruction *UserI = cast<Instruction>(U->getUser());
if (isa<UndefValue>(NewV)) {
- UnreachablesToInsert.push_back(UserI);
+ ToBeChangedToUnreachableInsts.insert(UserI);
} else {
TerminatorsToFold.push_back(UserI);
}
}
}
- for (Instruction *I : UnreachablesToInsert)
+ for (Instruction *I : ToBeChangedToUnreachableInsts)
changeToUnreachable(I, /* UseLLVMTrap */ false);
for (Instruction *I : TerminatorsToFold)
ConstantFoldTerminator(I->getParent());
OpenPOWER on IntegriCloud