[llvm] [InstCombine] Fold chained GEP with constant base into single GEP (PR #170439)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 2 23:47:32 PST 2025


nikic wrote:

> As far as I can tell, you seem to assume without verifying that both GEPs have the same source element type? You should probably just limit the transform to canonical i8 GEPs and use m_PtrAdd matchers.

Looking a bit closer, I guess this is implied by the combination of the preceding `Src->getResultElementType() != GEP.getSourceElementType()` check and the GEPs being single-index.

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


More information about the llvm-commits mailing list