-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[InstCombine] add control for SimplifyDemandedVectorElts depth limit #113717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[InstCombine] add control for SimplifyDemandedVectorElts depth limit #113717
Conversation
Allows customizing the depth of the recursive search on vectors that InstCombine does when looking for unused elements.
@llvm/pr-subscribers-llvm-transforms Author: Princeton Ferro (Prince781) ChangesAllows customizing the depth of the recursive search on vectors that InstCombine does when looking for unused elements. We find it helpful to be able to customize this for compile time reasons. Full diff: https://github.com/llvm/llvm-project/pull/113717.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 8ca705ae1d364d..5eb807dcb76cef 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -30,6 +30,12 @@ static cl::opt<bool>
"SimplifyDemandedBits() are consistent"),
cl::Hidden, cl::init(false));
+static cl::opt<unsigned> 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) {
|
LGTM although there may be some contention about adding another CLI option, so wait a few days to push to gives others a chance to comment. |
Ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the depth cutoff that you plan to use? And do you have a sharable test case demonstrating the compile-time issue?
I'm not opposed to having the option, but at the same time it would be nice to address the issue upstream, as other people may also encounter the issue.
Hi @nikic,
1, although we may have other values we'd like to use.
I'm not able to share anything yet, unfortunately. We have a few internal kernels that see a lot of improvement when this aspect of InstCombine is dialed down.
I agree. I'll actually be sending a few more patches to improve InstCombine compile time with vector operations soon. |
…lvm#113717) Allows customizing the depth of the recursive search on vectors that InstCombine does when looking for unused elements. We find it helpful to be able to customize this for compile time reasons.
Allows customizing the depth of the recursive search on vectors that InstCombine does when looking for unused elements.
We find it helpful to be able to customize this for compile time reasons.