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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 07:32:49 PDT 2025


nikic wrote:

The ongoing work on splitting GEPs should convert this into:
```
%gep = getelementptr [10 x [10 x i32]], ptr @base, i64 %i
%gep2 = getelementptr i8, ptr %gep, i64 100
```

We're not yet ready to generally convert the first one to use gep + mul, because not all optimizations will be able to deal with it.

It's possible to carve out exceptions to do this ahead of time (we already do this sometimes), but from reading https://github.com/llvm/llvm-project/issues/143219 I don't have a good understanding of when, and more importantly, *why* this specific case is beneficial. It just seems to perturb things slightly in a way that happens to work out for this specific benchmark?

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


More information about the llvm-commits mailing list