diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 8ca705ae1d364..5eb807dcb76ce 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -30,6 +30,12 @@ static cl::opt "SimplifyDemandedBits() are consistent"), cl::Hidden, cl::init(false)); +static cl::opt SimplifyDemandedVectorEltsDepthLimit( + "instcombine-simplify-vector-elts-depth", + cl::desc( + "Depth limit when simplifying vector instructions and their operands"), + cl::Hidden, cl::init(10)); + /// Check to see if the specified operand of the specified instruction is a /// constant integer. If so, check to see if there are any bits set in the /// constant that are not demanded. If so, shrink the constant and return true. @@ -1432,7 +1438,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V, } // Limit search depth. - if (Depth == 10) + if (Depth == SimplifyDemandedVectorEltsDepthLimit) return nullptr; if (!AllowMultipleUsers) {