[llvm] [AMDGPU] Update base addr of dyn alloca considering GrowingUp stack (PR #119822)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 22:37:42 PST 2024
================
@@ -4037,31 +4038,35 @@ SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(SDValue Op,
Chain = DAG.getCALLSEQ_START(Chain, 0, 0, dl);
SDValue Size = Tmp2.getOperand(1);
- SDValue SP = DAG.getCopyFromReg(Chain, dl, SPReg, VT);
- Chain = SP.getValue(1);
- MaybeAlign Alignment = cast<ConstantSDNode>(Tmp3)->getMaybeAlignValue();
+ SDValue BaseAddr = DAG.getCopyFromReg(Chain, dl, SPReg, VT);
+ Align Alignment = cast<ConstantSDNode>(Tmp3)->getAlignValue();
+
const TargetFrameLowering *TFL = Subtarget->getFrameLowering();
assert(TFL->getStackGrowthDirection() == TargetFrameLowering::StackGrowsUp &&
"Stack grows upwards for AMDGPU");
+ Chain = BaseAddr.getValue(1);
+ Align StackAlign = TFL->getStackAlign();
+ if (Alignment > StackAlign) {
+ auto ScaledAlignment = (uint64_t)Alignment.value()
----------------
easyonaadit wrote:
I see. I have changed it now.
https://github.com/llvm/llvm-project/pull/119822
More information about the llvm-commits
mailing list