[llvm] [CodeGen] Make LoadExtActions address-space aware (PR #162407)

Demetrius Kanios via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 10:09:45 PST 2025


================
@@ -1472,27 +1472,40 @@ class LLVM_ABI TargetLoweringBase {
   /// Return how this load with extension should be treated: either it is legal,
   /// needs to be promoted to a larger size, needs to be expanded to some other
   /// code sequence, or the target has a custom expander for it.
-  LegalizeAction getLoadExtAction(unsigned ExtType, EVT ValVT,
-                                  EVT MemVT) const {
-    if (ValVT.isExtended() || MemVT.isExtended()) return Expand;
-    unsigned ValI = (unsigned) ValVT.getSimpleVT().SimpleTy;
-    unsigned MemI = (unsigned) MemVT.getSimpleVT().SimpleTy;
+  LegalizeAction getLoadExtAction(unsigned ExtType, EVT ValVT, EVT MemVT,
+                                  unsigned AddrSpace) const {
----------------
QuantumSegfault wrote:

Yeah, I noticed that in GISel. That's actually exactly why I started #157161.

If not a map, then it seems that maybe getLoadExtAction and the likes should just be a virtual hook? Defaults to Legal, and we just move any exceptions into code in each target? Though that seems like a step backwards...

Did you have something particular in mind?

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


More information about the llvm-commits mailing list