[PATCH] D18619: [AArch64] Combine callee-save and local stack SP adjustment instructions.

Geoff Berry via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 08:17:04 PDT 2016


gberry added a comment.

Hi Tim,

I believe the below change fixes the problem you identified.  I'll upload a new version with this fix.  I'm still looking into your suggestion to refactor the code to avoid the stack size estimation in determinCalleeSaves() by doing the stack bump combining in emitPrologue/emitEpilogue instead to isolate the logic a bit more.

- a/lib/Target/AArch64/AArch64FrameLowering.cpp

+++ b/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -1116,7 +1116,8 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,

  // Check to see if we can combine the callee-save and local stack pointer
  // adjustment into a single decrement/increment.
  unsigned EstNonCSStackSize = MFI->estimateStackSize(MF);

- unsigned StackSize = EstNonCSStackSize + 8 * NumRegsSpilled;

+  unsigned StackSize =
+      alignTo(EstNonCSStackSize + 8 * NumRegsSpilled, getStackAlignment());

  if (EstNonCSStackSize != 0 &&
      // 512 is the maximum immediate for stp/ldp that will be used for
      // callee-save save/restores


http://reviews.llvm.org/D18619





More information about the llvm-commits mailing list