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

Raphael Moreira Zinsly via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 13:55:04 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 && NextMBB->begin()->getFlag(MachineInstr::FrameSetup)) {
----------------
rzinsly wrote:

It's indeed looking for `RISCV::PROBED_STACKALLOC_DYN`.
You're right it could be other BB before it, I'll need to change this and do a longer search.

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


More information about the llvm-commits mailing list