summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-12-31 17:37:01 +0000
committerSanjay Patel <spatel@rotateright.com>2016-12-31 17:37:01 +0000
commit7fd779f09f00b04fbd59c15ce28614cdeea1e0b4 (patch)
tree3e26487867ab1e7ef7bba2e11b3a727dedadbe81 /llvm/lib
parent21711c451e83efa8d83d3d202525ea3b2b2ca4c8 (diff)
downloadbcm5719-llvm-7fd779f09f00b04fbd59c15ce28614cdeea1e0b4.tar.gz
bcm5719-llvm-7fd779f09f00b04fbd59c15ce28614cdeea1e0b4.zip
[ValueTracking] make dominator tree requirement explicit for isKnownNonNullFromDominatingCondition(); NFCI
I don't think this hole is currently exposed, but I crashed regression tests for jump-threading and loop-vectorize after I added calls to isKnownNonNullAt() in InstSimplify as part of trying to solve PR28430: https://llvm.org/bugs/show_bug.cgi?id=28430 That's because they call into value tracking with a context instruction, but no other parts of the query structure filled in. For more background, see the discussion in: https://reviews.llvm.org/D27855 llvm-svn: 290786
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp7
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,
OpenPOWER on IntegriCloud