diff options
author | Daniil Suchkov <suc-daniil@yandex.ru> | 2020-03-05 16:24:53 +0700 |
---|---|---|
committer | Daniil Suchkov <suc-daniil@yandex.ru> | 2020-03-05 16:32:36 +0700 |
commit | 3db48f93248f005c8514a0050ef57f18a05bc489 (patch) | |
tree | dc79e95239d9dec5c9675a0d234639d1b9129fc1 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 5abfe646f5e194bb2330b80c7f0e23fba00e30fe (diff) | |
download | llvm-3db48f93248f005c8514a0050ef57f18a05bc489.zip llvm-3db48f93248f005c8514a0050ef57f18a05bc489.tar.gz llvm-3db48f93248f005c8514a0050ef57f18a05bc489.tar.bz2 |
Revert "[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into branch conditions of dominating blocks' terminators"
That commit causes SIGSEGV on some simple tests.
This reverts commit 952ad4701cf0d8da79789f6b83ddaa386c60d535.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 34f8abd..e11f5e2 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4525,9 +4525,7 @@ bool llvm::isOverflowIntrinsicNoWrap(const WithOverflowInst *WO, return llvm::any_of(GuardingBranches, AllUsesGuardedByBranch); } -bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V, - const Instruction *CtxI, - const DominatorTree *DT) { +bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) { // If the value is a freeze instruction, then it can never // be undef or poison. if (isa<FreezeInst>(V)) @@ -4560,29 +4558,6 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V, return true; } - if (!CtxI || !DT) - return false; - - // If V is used as a branch condition before reaching CtxI, V cannot be - // undef or poison. - // br V, BB1, BB2 - // BB1: - // CtxI ; V cannot be undef or poison here - auto Dominator = DT->getNode(CtxI->getParent())->getIDom(); - while (Dominator) { - auto *TI = Dominator->getBlock()->getTerminator(); - - if (auto BI = dyn_cast<BranchInst>(TI)) { - if (BI->isConditional() && BI->getCondition() == V) - return true; - } else if (auto SI = dyn_cast<SwitchInst>(TI)) { - if (SI->getCondition() == V) - return true; - } - - Dominator = Dominator->getIDom(); - } - return false; } |