[PATCH] D100574: [RISCV] Fix missing emergency slots for scalable stack offsets

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 00:55:26 PDT 2021


frasercrmck marked an inline comment as done.
frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:863
+    // For RVV, scalable stack offsets require up to two scratch registers to
+    // compute the final offset. Reserve an additional emergency spill slot.
+    if (RVVStackSize != 0) {
----------------
HsiangKai wrote:
> What if `!isInt<11>(MFI.estimateStackSize(MF))` and `RVVStackSize != 0` occurred in the same function, do we need three or two emergency spill slot in total?
I had assumed the worst case would still be two, but I'll run some tests.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:1364
+        .addReg(N, RegState::Kill)
+        .addReg(VL, RegState::Kill);
   }
----------------
HsiangKai wrote:
> Sorry, it is my fault. We may have no need to switch the order of the operands.
> Let's keep the order to reduce the difference in the test cases.
> 
> ```
> BuildMI(MBB, II, DL, TII->get(RISCV::MUL), VL)
>     .addReg(VL, RegState::Kill)
>     .addReg(N, RegState::Kill);
> ```
Makes sense, the diff is better like this. Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100574



More information about the llvm-commits mailing list