[llvm] [AMDGPU] Support divergent sized dynamic alloca (PR #121148)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 08:27:09 PST 2025


================
@@ -4057,30 +4054,36 @@ SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(SDValue Op,
                            DAG.getSignedConstant(-ScaledAlignment, dl, VT));
   }
 
-  SDValue ScaledSize = DAG.getNode(
-      ISD::SHL, dl, VT, Size,
-      DAG.getConstant(Subtarget->getWavefrontSizeLog2(), dl, MVT::i32));
-
-  SDValue NewSP = DAG.getNode(ISD::ADD, dl, VT, BaseAddr, ScaledSize); // Value
+  assert(Size.getValueType() == MVT::i32 && "Size must be 32-bit");
+  SDValue NewSP;
+  if (isa<ConstantSDNode>(Op.getOperand(1))) {
----------------
s-barannikov wrote:

```suggestion
  if (isa<ConstantSDNode>(Size)) {
```

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


More information about the llvm-commits mailing list