Skip to content

Commit 98e6e97

Browse files
committed
[InstCombine] add control for SimplifyDemandedVectorElts depth limit
Allows customizing the depth of the recursive search on vectors that InstCombine does when looking for unused elements.
1 parent ac4bd74 commit 98e6e97

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ static cl::opt<bool>
3030
"SimplifyDemandedBits() are consistent"),
3131
cl::Hidden, cl::init(false));
3232

33+
static cl::opt<unsigned> SimplifyDemandedVectorEltsDepthLimit(
34+
"instcombine-simplify-vector-elts-depth",
35+
cl::desc(
36+
"Depth limit when simplifying vector instructions and their operands"),
37+
cl::Hidden, cl::init(10));
38+
3339
/// Check to see if the specified operand of the specified instruction is a
3440
/// constant integer. If so, check to see if there are any bits set in the
3541
/// constant that are not demanded. If so, shrink the constant and return true.
@@ -1432,7 +1438,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
14321438
}
14331439

14341440
// Limit search depth.
1435-
if (Depth == 10)
1441+
if (Depth == SimplifyDemandedVectorEltsDepthLimit)
14361442
return nullptr;
14371443

14381444
if (!AllowMultipleUsers) {

0 commit comments

Comments
 (0)