[llvm] [RISCV] Force a frame pointer when the max reserved call frame exceeds simm12. (PR #182124)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 13:47:11 PST 2026


================
@@ -237,6 +238,17 @@ bool RISCVSubtarget::enableMachinePipeliner() const {
   return getSchedModel().hasInstrSchedModel();
 }
 
+void RISCVSubtarget::mirFileLoaded(MachineFunction &MF) const {
+  // We usually compute max call frame size after ISel. Do the computation now
+  // if the .mir file didn't specify it. Note that this will probably give you
+  // bogus values after PEI has eliminated the callframe setup/destroy pseudo
+  // instructions, specify explicitly if you need it to be correct.
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+  if (!MFI.isMaxCallFrameSizeComputed()) {
+    MFI.computeMaxCallFrameSize(MF);
+  }
----------------
topperc wrote:

```suggestion
  if (!MFI.isMaxCallFrameSizeComputed())
    MFI.computeMaxCallFrameSize(MF);
```

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


More information about the llvm-commits mailing list