[llvm] [RISCV] Stack clash protection for dynamic alloca (PR #122508)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 16:25:01 PST 2025


================
@@ -545,6 +545,16 @@ void RISCVFrameLowering::allocateAndProbeStackForRVV(
       .addReg(SPReg)
       .addReg(TargetReg)
       .setMIFlag(Flag);
+
+  // If we have a dynamic allocation later we need to probe any residuals.
+  MachineBasicBlock *NextMBB = MBBI->getParent()->getSingleSuccessor();
+  if (NextMBB != NULL && NextMBB->begin()->getFlag(MachineInstr::FrameSetup)) {
----------------
topperc wrote:

Do not use `NULL`. Use `nullptr` or `NextBB && NextMBB->begin()->getFlag(MachineInstr::FrameSetup)`

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


More information about the llvm-commits mailing list