[llvm] [InstCombine] add control for SimplifyDemandedVectorElts depth limit (PR #113717)
Princeton Ferro via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 17:11:33 PDT 2024
https://github.com/Prince781 updated https://github.com/llvm/llvm-project/pull/113717
>From 98e6e97b774620f27a053bb0885f94c716753464 Mon Sep 17 00:00:00 2001
From: Princeton Ferro <pferro at nvidia.com>
Date: Thu, 3 Oct 2024 14:35:36 -0700
Subject: [PATCH] [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.
---
.../InstCombine/InstCombineSimplifyDemanded.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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) {
More information about the llvm-commits
mailing list