[PATCH] D128188: [RISCV] Add a scavenge spill slot when use ADDI to compute scalable stack offset

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 26 23:48:30 PDT 2022


StephenFan added a comment.

In D128188#3599342 <https://reviews.llvm.org/D128188#3599342>, @craig.topper wrote:

> Is it possible to add a test where we use the 2 slots for spills?

I added a mir test since it seems that .ll test can't reflect the number of scavenging slots very well.



================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:962
+          // require up to one scratch register.
+          LocalMostScavSlotsNum = isScalableVectorID ? 2 : 1;
+        } else if (MI.getOpcode() == RISCV::ADDI) {
----------------
craig.topper wrote:
> Why not use std::max here? Why separate local/global variable?
You are right, the `local` variable is redundant and I should use std::max here


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:970
+      }
+      GlobalMostScavSlotsNum = std::max(GlobalMostScavSlotsNum, LocalMostScavSlotsNum);
+    }
----------------
craig.topper wrote:
> Should we stop searching when `GlobalMostScavSlotsNum` becomes 2?
Yes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128188/new/

https://reviews.llvm.org/D128188



More information about the llvm-commits mailing list