From 3271f379a9cdce9d67dbe0feefa0142ce5c36347 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Mon, 6 Aug 2018 08:10:28 +0000 Subject: Revert rL338990 to see if it causes sanitizer failures Multiple failues reported by sanitizer-x86_64-linux, seem to be caused by this patch. Reverting to see if they sustain without it. Differential Revision: https://reviews.llvm.org/D50172 llvm-svn: 338994 --- llvm/lib/Analysis/ValueTracking.cpp | 38 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 65c5d0e..edd46c5 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1861,36 +1861,18 @@ static bool isKnownNonNullFromDominatingCondition(const Value *V, continue; for (auto *CmpU : U->users()) { - SmallVector WorkList; - SmallPtrSet Visited; - Visited.insert(CmpU); - WorkList.push_back(CmpU); - - while (!WorkList.empty()) { - auto *Curr = WorkList.pop_back_val(); - - // If a user is an AND, add all its users to the work list. - if (auto *BO = dyn_cast(Curr)) - if (BO->getOpcode() == Instruction::And) { - for (auto *BOU : BO->users()) - if (Visited.insert(BOU).second) - WorkList.push_back(BOU); - continue; - } - - if (const BranchInst *BI = dyn_cast(Curr)) { - assert(BI->isConditional() && "uses a comparison!"); + if (const BranchInst *BI = dyn_cast(CmpU)) { + assert(BI->isConditional() && "uses a comparison!"); - BasicBlock *NonNullSuccessor = - BI->getSuccessor(Pred == ICmpInst::ICMP_EQ ? 1 : 0); - BasicBlockEdge Edge(BI->getParent(), NonNullSuccessor); - if (Edge.isSingleEdge() && DT->dominates(Edge, CtxI->getParent())) - return true; - } else if (Pred == ICmpInst::ICMP_NE && - match(Curr, m_Intrinsic()) && - DT->dominates(cast(Curr), CtxI)) { + BasicBlock *NonNullSuccessor = + BI->getSuccessor(Pred == ICmpInst::ICMP_EQ ? 1 : 0); + BasicBlockEdge Edge(BI->getParent(), NonNullSuccessor); + if (Edge.isSingleEdge() && DT->dominates(Edge, CtxI->getParent())) return true; - } + } else if (Pred == ICmpInst::ICMP_NE && + match(CmpU, m_Intrinsic()) && + DT->dominates(cast(CmpU), CtxI)) { + return true; } } } -- cgit v1.1