[llvm] [RISCV] Loosen the requirement of shadow stack codegen to Zimop (PR #152251)

Jesse Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 00:55:24 PDT 2025


================
@@ -107,7 +107,7 @@ static void emitSCSPrologue(MachineFunction &MF, MachineBasicBlock &MBB,
                             const DebugLoc &DL) {
   const auto &STI = MF.getSubtarget<RISCVSubtarget>();
   bool HasHWShadowStack = MF.getFunction().hasFnAttribute("hw-shadow-stack") &&
-                          STI.hasStdExtZicfiss();
+                          STI.hasStdExtZimop();
----------------
jaidTw wrote:

My point is acutally different. According to Spec, Zimop is a dependency of Zicfiss while Zcmop is optional, for me it does not make sense to emit any shadow stack instructions if Zimop is not present, as not every shadow stack instructions have a compressed form.
I personally don't think it will be useful to only generate `c.sspush/c.sspopck` without some supporting routine managing the shadow stack using `ssrdp/ssamoswap` that requires Zimop

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


More information about the llvm-commits mailing list