[llvm] [InstCombine] Add limit for expansion of gep chains (PR #147065)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 5 00:21:44 PDT 2025
================
@@ -2144,13 +2144,35 @@ CommonPointerBase CommonPointerBase::compute(Value *LHS, Value *RHS) {
return Base;
}
+bool CommonPointerBase::isExpensive() const {
+ bool SeenConst = false;
+ unsigned NumGEPs = 0;
+ auto ProcessGEPs = [&SeenConst, &NumGEPs](ArrayRef<GEPOperator *> GEPs) {
+ bool SeenMultiUse = false;
+ for (GEPOperator *GEP : GEPs) {
+ // Only count GEPs after the first multi-use GEP. For the first one,
+ // we will directly reuse the offset.
----------------
nikic wrote:
Do you think it would be better to start with changing the GEP expansion/rewriting?
https://github.com/llvm/llvm-project/pull/147065
More information about the llvm-commits
mailing list