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

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 10:29:51 PDT 2026


================
@@ -138,6 +138,12 @@ bool RISCVPushPopOpt::runOnMachineFunction(MachineFunction &Fn) {
   if (!Subtarget->hasStdExtZcmp() && !Subtarget->hasVendorXqccmp())
     return false;
 
+  // We don't want any popret[z] instructions when emitting code with hardware
+  // shadow stack protection.
+  if (Fn.getFunction().hasFnAttribute("hw-shadow-stack") &&
+      Subtarget->hasStdExtZimop())
+    return false;
----------------
lenary wrote:

I don't mind if it's left in, but maybe worth having a quick comment that we know it won't be triggered, as opposed to because the pass has to have the condition to be correct.

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


More information about the llvm-commits mailing list