diff options
author | Sanjay Patel <spatel@rotateright.com> | 2020-08-19 16:32:24 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2020-08-19 16:56:59 -0400 |
commit | 6f3511a01a5227358a334803c264cfce4175ca5d (patch) | |
tree | b94e33a537035dad851bc64dfed74584c7bec01f /llvm/lib/Analysis/VectorUtils.cpp | |
parent | d34df52377fda5452a8c244a8378957eaed66700 (diff) | |
download | llvm-6f3511a01a5227358a334803c264cfce4175ca5d.zip llvm-6f3511a01a5227358a334803c264cfce4175ca5d.tar.gz llvm-6f3511a01a5227358a334803c264cfce4175ca5d.tar.bz2 |
[ValueTracking] define/use max recursion depth in header
There's a potential motivating case to increase this limit in PR47191:
http://bugs.llvm.org/PR47191
But first we should make it less hacky. The limit in InstCombine is directly tied
to this value because an increase there can cause asserts in the underlying value
tracking calls if not changed together. The usage in VectorUtils is independent,
but the comment suggests that we should use the same value unless there's a known
reason to diverge. There are similar limits in codegen analysis, but I think we
should leave those independent in case we intentionally want the optimization
power/cost to be different there.
Differential Revision: https://reviews.llvm.org/D86113
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r-- | llvm/lib/Analysis/VectorUtils.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index cdcbd15..0bc8b72 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -357,12 +357,8 @@ const llvm::Value *llvm::getSplatValue(const Value *V) { return nullptr; } -// This setting is based on its counterpart in value tracking, but it could be -// adjusted if needed. -const unsigned MaxDepth = 6; - bool llvm::isSplatValue(const Value *V, int Index, unsigned Depth) { - assert(Depth <= MaxDepth && "Limit Search Depth"); + assert(Depth <= MaxAnalysisRecursionDepth && "Limit Search Depth"); if (isa<VectorType>(V->getType())) { if (isa<UndefValue>(V)) @@ -389,7 +385,7 @@ bool llvm::isSplatValue(const Value *V, int Index, unsigned Depth) { } // The remaining tests are all recursive, so bail out if we hit the limit. - if (Depth++ == MaxDepth) + if (Depth++ == MaxAnalysisRecursionDepth) return false; // If both operands of a binop are splats, the result is a splat. |