[PATCH] D89239: [RISCV][PrologEpilogInserter] "Float" emergency spill slots to avoid making them immediately unreachable from the stack pointer

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 09:41:08 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1085
+    // then the scavenging spill slots may become harder to reach from the
+    // stack pointer, float them so they stay close.
+    if (OffsetBeforeAlignment != Offset && RS && !EarlyScavengingSlots) {
----------------
If the stack alignment is large enough that all immediate offsets from the stack pointer are stuck in padding, the performance of the resulting code is going to be terrible, period.  Really, we want the gap somewhere between the allocas that require it, and the rest of the stack allocations.  Changing the location of the scavenging slot, specifically, seems a bit hacky.  Maybe it's good enough, though.

On a related note, I'm tempted to say we should add a mechanism to allow targets to cap stack realignment to something sane, to allow avoiding situations like this. (We currently have isStackRealignable(), but that completely disables realignment.)


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

https://reviews.llvm.org/D89239



More information about the llvm-commits mailing list