[llvm] [InstCombine] Lower multi-dimensional GEP to ptradd (PR #150383)

Usha Gupta via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 07:11:32 PDT 2025


usha1830 wrote:

> Please let me know if I can help investigating/resolving the failures. I am looking forward to enabling the `noalias` setting in Flang, so if there is a work to share, I am here to help.

@vzakhari After adding more constraints to the GEP transformation, all tests are now passing.

However, with the latest LLVM main, I’m seeing that this patch no longer gives the same performance benefit as before.

@nikic Do you think the GEP lowering I’m trying in this PR would still be generally useful for InstCombine or CodeGen? For example, I’m lowering:

```llvm
%gep = getelementptr [10 x [10 x [10 x i32]]], ptr @base, i64 0, i64 %i, i64 2, i64 5

to 

%idx1 = mul i64 %i, 400
%tmp0 = getelementptr i8, ptr @base, i64 %idx1
%gep = getelementptr i8, ptr %tmp0, i64 100
````
Is there value in this sort of flattening/canonicalization after your latest changes around splitting/lowering geps in the current LLVM codebase?

Would appreciate your thoughts or a review. Thank you!

https://github.com/llvm/llvm-project/pull/150383


More information about the llvm-commits mailing list