[llvm] Add a pass "SinkGEPConstOffset" (PR #140657)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 03:49:03 PDT 2025


nikic wrote:

> > I think #143470 might be implementing the same thing in SeparateConstOffsetFromGEP?
> 
> I don't think the two patches function in exactly the same way. That patch just merges the const in the base part of the GEP expression. But this patch presupposes that base is a GEP, and by implication, presupposes that it's a strict GEP chain, and the function is to sink the const offset down the GEP chain to the end. The two are oriented to different patterns.

I'm not sure I follow. Do you maybe have an example where this patch works but the other patch does not?

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


More information about the llvm-commits mailing list