[llvm] [RISCV] Reduce spill/reload pairs when Xqcilo extension is enabled (PR #212807)

Garvit Gupta via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 05:28:04 PDT 2026


================
@@ -615,6 +640,18 @@ bool RISCVRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
       // instruction will add 4 to the immediate. If that would overflow 12
       // bits, we can't fold the offset.
       MI.getOperand(FIOperandNum + 1).ChangeToImmediate(0);
+    } else if (!isInt<12>(Val) && ST.hasVendorXqcilo() &&
+               getXqciloWideOpcode(Opc)) {
+      // The resolved frame offset exceeds simm12 but the instruction is a
+      // standard load/store (LW/SW/etc). Promote to the wide Xqcilo equivalent
+      // so the full 26-bit offset folds directly, avoiding a separate
+      // base-adjust instruction. This runs post-RA and does not affect
+      // register allocation decisions.
+      unsigned WideOpc = getXqciloWideOpcode(Opc);
----------------
quic-garvgupt wrote:

Fixed

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


More information about the llvm-commits mailing list