[llvm] [CodeGen] Make LoadExtActions address-space aware (PR #162407)
Demetrius Kanios via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 8 10:35:10 PDT 2025
QuantumSegfault wrote:
@dschuff
Alright, so I'm close to finishing @sparker-arm started. I made sure it doesn't introduce any regressions in the AMDGPU or WebAssembly backends. I imagine NVPTX will also need adjusting, but I haven't gotten around to compiling all the rest of LLVM yet.
However, I'm not quite satisfied with it as is. Currently there's a default parameter on `setLoadExtAction` to avoid needing to modify every single backend. However it's more a footgun than anything, as the default behavior has still changed.
I feel it makes more sense to remove the parameter, but that then touches virtually every backend, and requires everybody to learn the new behavior.
OR: We change the tactic a little. Make the map an optional override. We add a new `LegalizeAction::Unspecified`. New address spaces put into the override map are filled with Unspecified (I'm thinking 0xF?). During look up, it checks the map first, then falls back to the old/existing LoadExtActions if seeing `Unspecified`. Probably have a default AddrSpace of `~0` on `setLoadExtAction`, meaning modify it for all address-spaces (the fallback mapping).
At that rate, might as well make the map a sparse `(AddrSpace, ValVT, MemVT) => LegalizeAction` map, since it will be rarely used. Could probably even pack that key in a single `uint64_t`...or would a `std::pair<unsigned, uint16_t>` be preferrable?
That should allow leaving the backends as is, making the feature opt-in.
https://github.com/llvm/llvm-project/pull/162407
More information about the llvm-commits
mailing list