diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 30bd08471d5..48f5c59ba61 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3368,6 +3368,8 @@ static bool isKnownNonNullFromDominatingCondition(const Value *V, const DominatorTree *DT) { assert(V->getType()->isPointerTy() && "V must be pointer type"); assert(!isa<ConstantData>(V) && "Did not expect ConstantPointerNull"); + assert(CtxI && "Context instruction required for analysis"); + assert(DT && "Dominator tree required for analysis"); unsigned NumUsesExplored = 0; for (auto *U : V->users()) { @@ -3410,7 +3412,10 @@ bool llvm::isKnownNonNullAt(const Value *V, const Instruction *CtxI, if (isKnownNonNull(V)) return true; - return CtxI ? ::isKnownNonNullFromDominatingCondition(V, CtxI, DT) : false; + if (!CtxI || !DT) + return false; + + return ::isKnownNonNullFromDominatingCondition(V, CtxI, DT); } OverflowResult llvm::computeOverflowForUnsignedMul(const Value *LHS, |