[llvm] [RISCV] Disable shrink wrapping for SiFive CLIC preemptible handlers (PR #218347)
Zeyi Xu via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 01:35:28 PDT 2026
================
@@ -2647,6 +2647,9 @@ bool RISCVFrameLowering::restoreCalleeSavedRegisters(
}
bool RISCVFrameLowering::enableShrinkWrapping(const MachineFunction &MF) const {
+ if (MF.getInfo<RISCVMachineFunctionInfo>()->isSiFivePreemptibleInterrupt(MF))
----------------
zeyi2 wrote:
A short rationale on why I chose to disable the pass:
ShrinkWrap runs before the target-specific CLIC prologue is emitted, so it cannot see that saving `mcause`/`mepc` and enabling interrupts are mandatory on every handler path.
`TargetFrameLowering::enableShrinkWrapping()` is the existing target hook for cases where a target-specific prologue cannot be safely shrink-wrapped. Other backends use it for similar entry-only prologues, such as [ARM CMSE entry functions](https://github.com/llvm/llvm-project/blob/d9641906f295fc1c3d5b540dcc35c5dcab3e0de0/llvm/lib/Target/ARM/ARMFrameLowering.cpp#L2703-L2708) and [X86 segmented stacks](https://github.com/llvm/llvm-project/blob/d9641906f295fc1c3d5b540dcc35c5dcab3e0de0/llvm/lib/Target/X86/X86FrameLowering.cpp#L4148-L4161).
https://github.com/llvm/llvm-project/pull/218347
More information about the llvm-commits
mailing list