From 96669965635a85a01e915dc07526f92108498782 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 17 Jan 2017 18:15:49 +0000 Subject: [ValueTracking] recognize a 'not' of an assumed condition as false Also, add the corresponding match to the AssumptionCache's 'Affected Values' list. Differential Revision: https://reviews.llvm.org/D28485 llvm-svn: 292239 --- llvm/lib/Analysis/AssumptionCache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Analysis/AssumptionCache.cpp') diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp index 5851594700a..4e287e5f6bc 100644 --- a/llvm/lib/Analysis/AssumptionCache.cpp +++ b/llvm/lib/Analysis/AssumptionCache.cpp @@ -47,9 +47,11 @@ void AssumptionCache::updateAffectedValues(CallInst *CI) { } else if (auto *I = dyn_cast(V)) { Affected.push_back(I); - if (I->getOpcode() == Instruction::BitCast || - I->getOpcode() == Instruction::PtrToInt) { - auto *Op = I->getOperand(0); + // Peek through unary operators to find the source of the condition. + Value *Op; + if (match(I, m_BitCast(m_Value(Op))) || + match(I, m_PtrToInt(m_Value(Op))) || + match(I, m_Not(m_Value(Op)))) { if (isa(Op) || isa(Op)) Affected.push_back(Op); } -- cgit v1.2.3