summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-08-09 15:13:50 +0000
committerDavide Italiano <davide@freebsd.org>2017-08-09 15:13:50 +0000
commit30e5194287a733e5cbfbf3ef95ecadce88a559da (patch)
tree9e71c74e0aaea7488486c14a070b6130d2949709 /llvm/lib/Analysis/ValueTracking.cpp
parent79876332638603b735b8317d44b8a143455fee1c (diff)
downloadbcm5719-llvm-30e5194287a733e5cbfbf3ef95ecadce88a559da.tar.gz
bcm5719-llvm-30e5194287a733e5cbfbf3ef95ecadce88a559da.zip
[ValueTracking] Honour recursion limit.
The recently improved support for `icmp` in ValueTracking (r307304) exposes the fact that `isImplied` condition doesn't really bail out if we hit the recursion limit (and calls `computeKnownBits` which increases the depth and asserts). Differential Revision: https://reviews.llvm.org/D36512 llvm-svn: 310481
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 5372d9dc7c2..995b3e0c6de 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4556,6 +4556,10 @@ static Optional<bool> isImpliedCondAndOr(const BinaryOperator *LHS,
Optional<bool> llvm::isImpliedCondition(const Value *LHS, const Value *RHS,
const DataLayout &DL, bool LHSIsTrue,
unsigned Depth) {
+ // Bail out when we hit the limit.
+ if (Depth == MaxDepth)
+ return None;
+
// A mismatch occurs when we compare a scalar cmp to a vector cmp, for
// example.
if (LHS->getType() != RHS->getType())
OpenPOWER on IntegriCloud