[llvm] [CodeGen] Replace (Min,Max)CSFrameIndex with flag on frame object [NFCI] (PR #170905)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 6 13:57:37 PST 2025


================
@@ -923,20 +911,28 @@ void PEIImpl::calculateFrameObjectOffsets(MachineFunction &MF) {
   Align MaxAlign = MFI.getMaxAlign();
   // First assign frame offsets to stack objects that are used to spill
   // callee saved registers.
-  if (MaxCSFrameIndex >= MinCSFrameIndex) {
-    for (unsigned i = 0; i <= MaxCSFrameIndex - MinCSFrameIndex; ++i) {
-      unsigned FrameIndex =
-          StackGrowsDown ? MinCSFrameIndex + i : MaxCSFrameIndex - i;
-
+  if (StackGrowsDown) {
----------------
preames wrote:

Personally, I'd find that *much* harder to reason about.  The idea of using a sequence is interesting though, maybe we could conditional reverse a sequence instead?  I'll play with this a bit and may tag you for review on a followup.  

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


More information about the llvm-commits mailing list