[llvm] [AMDGPU] Fix selection of s_load_b96 on GFX11 (PR #108029)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 17:40:27 PDT 2024


================
@@ -10334,24 +10335,24 @@ SDValue SITargetLowering::LowerLOAD(SDValue Op, SelectionDAG &DAG) const {
     // have the same legalization requirements as global and private
     // loads.
     //
-  }
 
-  if (AS == AMDGPUAS::CONSTANT_ADDRESS ||
-      AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT ||
-      AS == AMDGPUAS::GLOBAL_ADDRESS) {
-    if (Subtarget->getScalarizeGlobalBehavior() && !Op->isDivergent() &&
-        Load->isSimple() && isMemOpHasNoClobberedMemOperand(Load) &&
-        Alignment >= Align(4) && NumElements < 32) {
-      if (MemVT.isPow2VectorType() ||
-          (Subtarget->hasScalarDwordx3Loads() && NumElements == 3))
-        return SDValue();
-      return WidenOrSplitVectorLoad(Op, DAG);
+    if (AS == AMDGPUAS::CONSTANT_ADDRESS ||
----------------
perlfu wrote:

`AMDGPUAS::CONSTANT_ADDRESS` and `AMDGPUAS::CONSTANT_ADDRESS_32BIT` do nothing here as they are completely handled by the previous `if()`?
If so, then you can hoist inner `if(Subtarget...` and merge `AS == ...` condition into it?

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


More information about the llvm-commits mailing list