[PATCH] D146862: [X86] Fix the incorrect displacement for prolog/epilog

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 20:31:47 PDT 2023


pengfei added inline comments.


================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:1590
     BuildStackAlignAND(MBB, MBBI, DL, StackPtr, MaxAlign);
-    int64_t Offset = Is64Bit ? -2 * (int64_t)SlotSize : -1 * (int64_t)SlotSize;
+    int64_t Offset = -1 * (int64_t)SlotSize;
     BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::PUSH64rmm: X86::PUSH32rmm))
----------------
Curious why using 2 before. I was thinking it's related to stack aligement. AFAIK, Windows requires the stack always aligned to 16B on 64-bits.

Is better to directly `int64_t Offset = -SlotSize`?


================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:2327
         .addUse(X86::NoRegister)
-        .addImm((int64_t)SlotSize * -2)
+        .addImm((int64_t)SlotSize * -1)
         .addUse(X86::NoRegister)
----------------
ditto.


================
Comment at: llvm/test/CodeGen/X86/i386-baseptr.ll:77
+; CHECK-NEXT:    leal -4(%ecx), %esp
 ; CHECK-NEXT:    .cfi_def_cfa %esp, 4
 ; CHECK-NEXT:    retl
----------------
The dwarf doesn't need to update together?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146862



More information about the llvm-commits mailing list