[llvm] [IR] Add require-logical-module module flag (PR #193502)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 06:07:40 PDT 2026


Keenuts wrote:

> Do you have any idea how many transforms we have that create GEPs "out of thin air"? I'm trying to understand what kind of impact we can expect across the codebase.

Passes which statically create GEP seem to be:
- ArgumentPromotion
- InstCombine\*
- DSE
- ExpandMemCmp
- LoopVectorize (CreatePtrAdd)
- SimplifyCFG
- SROA -> Dealt with LSROA
- GlobalOpt (constant only)

The plan is essentially to add this hard failure so we can bit-by-bit figure out what pass triggered a GEP and fix them up, and also prevent regressions.

> Should this be a module flag or a data layout property? For a given target, will it always be either logical or physical?

I think we might want to have per-address space flag in the future (@s-perron PhysicalStorageBuffer would need it I think)
So if that's possible, maybe a new section is the triple would be better, something like:
`lp0:1:2` to say `Address space 0, 1 and 2 are using logical pointers`?






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


More information about the llvm-commits mailing list