]> granicus.if.org Git - llvm/commit
[AArch64][DebugInfo] Do not recompute CalleeSavedStackSize
authorSander de Smalen <sander.desmalen@arm.com>
Wed, 18 Sep 2019 09:02:44 +0000 (09:02 +0000)
committerSander de Smalen <sander.desmalen@arm.com>
Wed, 18 Sep 2019 09:02:44 +0000 (09:02 +0000)
commit1348de6c20884377789178219914aa469f8136c0
tree3c098d9b7fdeeecc7ff2086b6d546ba8ab63c274
parent5b8d1e30a2c7f87a5729be19c1f93b6e198dcfaa
[AArch64][DebugInfo] Do not recompute CalleeSavedStackSize

This patch fixes a bug exposed by 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.

Reviewers: omjavaid, eli.friedman, thegameg, efriedma

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D66935

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372204 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/TargetFrameLowering.h
lib/CodeGen/LiveDebugValues.cpp
lib/CodeGen/RegUsageInfoCollector.cpp
lib/CodeGen/TargetFrameLoweringImpl.cpp
lib/Target/AArch64/AArch64FrameLowering.cpp
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/ARMFrameLowering.h
test/CodeGen/AArch64/wrong-callee-save-size-after-livedebugvariables.mir [new file with mode: 0644]
test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir
test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir