[llvm] [RISC-V] Do not emit cm.popret[z] with zicfiss (PR #196267)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 13:47:04 PDT 2026


================
@@ -193,6 +194,9 @@ static void emitSCSEpilogue(MachineFunction &MF, MachineBasicBlock &MBB,
           CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; }))
     return;
 
+  // The shadow call stack popchk needs to happen after cm.pop that loads ra.
+  if (MI->getOpcode() == RISCV::CM_POP || MI->getOpcode() == RISCV::QC_CM_POP)
+    ++MI;
----------------
ilovepi wrote:

Based on the assert, I'm guessing the guard here isn't quite right.

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


More information about the llvm-commits mailing list