[PATCH] D66935: [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 03:34:39 PDT 2019


sdesmalen created this revision.
sdesmalen added reviewers: omjavaid, eli.friedman, thegameg.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar, aprantl.
Herald added a project: LLVM.

This patch fixes a bug exposed by D65653 <https://reviews.llvm.org/D65653> where a subsequent invocation
of `determineCalleeSaves` ends up with a different size for the callee
save area, leading to different frame-offsets in debug information.

In the invocation by PEI, `determineCalleeSaves` tries to determine
whether it needs to spill an extra callee-saved register to get an
emergency spill slot. To do this, it calls 'estimateStackSize' and
manually adds the size of the callee-saves to this. PEI then allocates
the spill objects for the callee saves and the remaining frame layout
is calculated accordingly.

A second invocation in LiveDebugValues causes estimateStackSize to return
the size of the stack frame including the callee-saves. Given that the
size of the callee-saves is added to this, these callee-saves are counted
twice, which leads `determineCalleeSaves` to believe the stack has
become big enough to require spilling an extra callee-save as emergency
spillslot. It then updates CalleeSavedStackSize with a larger value.

Since CalleeSavedStackSize is used in the calculation of the frame
offset in getFrameIndexReference, this leads to incorrect offsets for
variables/locals when this information is recalculated after PEI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66935

Files:
  llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
  llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
  llvm/test/CodeGen/AArch64/wrong-callee-save-size-after-livedebugvariables.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66935.217815.patch
Type: text/x-patch
Size: 7543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190829/0b67e9bc/attachment.bin>


More information about the llvm-commits mailing list