From 3db48f93248f005c8514a0050ef57f18a05bc489 Mon Sep 17 00:00:00 2001 From: Daniil Suchkov Date: Thu, 5 Mar 2020 16:24:53 +0700 Subject: Revert "[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into branch conditions of dominating blocks' terminators" That commit causes SIGSEGV on some simple tests. This reverts commit 952ad4701cf0d8da79789f6b83ddaa386c60d535. --- llvm/lib/Analysis/ValueTracking.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') 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(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(TI)) { - if (BI->isConditional() && BI->getCondition() == V) - return true; - } else if (auto SI = dyn_cast(TI)) { - if (SI->getCondition() == V) - return true; - } - - Dominator = Dominator->getIDom(); - } - return false; } -- cgit v1.1