[llvm] [RISCV] Stack clash protection for dynamic alloca (PR #122508)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 15:59:10 PST 2025
================
@@ -22559,3 +22564,96 @@ unsigned RISCVTargetLowering::getStackProbeSize(const MachineFunction &MF,
StackProbeSize = alignDown(StackProbeSize, StackAlign.value());
return StackProbeSize ? StackProbeSize : StackAlign.value();
}
+
+SDValue RISCVTargetLowering::lowerDYNAMIC_STACKALLOC(SDValue Op,
+ SelectionDAG &DAG) const {
+ MachineFunction &MF = DAG.getMachineFunction();
+ if (!hasInlineStackProbe(MF))
+ return SDValue();
+
+ MVT XLenVT = Subtarget.getXLenVT();
+ // Get the inputs.
+ SDNode *Node = Op.getNode();
+ SDValue Chain = Op.getOperand(0);
+ SDValue Size = Op.getOperand(1);
+
+ MaybeAlign Align =
+ cast<ConstantSDNode>(Op.getOperand(2))->getMaybeAlignValue();
+ SDLoc dl(Op);
+ EVT VT = Node->getValueType(0);
----------------
topperc wrote:
Can we use `Op.getValueType()` here? Then `Node` is unneeded.
https://github.com/llvm/llvm-project/pull/122508
More information about the llvm-commits
mailing list