[PATCH] D143618: [X86] Fix for offsets of CFA directives
Theodoros Kasampalis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 18:01:45 PST 2023
theo25 created this revision.
theo25 added reviewers: pengfei, Gerolf.
theo25 added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
theo25 requested review of this revision.
Herald added a subscriber: llvm-commits.
`emitPrologue` may insert stack pointer adjustment in tail call optimized functions where the callee argument stack size is bigger than the caller's. In such a case, the adjustment must be taken into account when generating CFA directives.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143618
Files:
llvm/lib/Target/X86/X86FrameLowering.cpp
Index: llvm/lib/Target/X86/X86FrameLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86FrameLowering.cpp
+++ llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -1649,14 +1649,16 @@
// Define the current CFA rule to use the provided offset.
assert(StackSize);
BuildCFI(MBB, MBBI, DL,
- MCCFIInstruction::cfiDefCfaOffset(nullptr, -2 * stackGrowth),
+ MCCFIInstruction::cfiDefCfaOffset(
+ nullptr, -2 * stackGrowth + (int)TailCallArgReserveSize),
MachineInstr::FrameSetup);
// Change the rule for the FramePtr to be an "offset" rule.
unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true);
BuildCFI(MBB, MBBI, DL,
- MCCFIInstruction::createOffset(nullptr, DwarfFramePtr,
- 2 * stackGrowth),
+ MCCFIInstruction::createOffset(
+ nullptr, DwarfFramePtr,
+ 2 * stackGrowth - (int)TailCallArgReserveSize),
MachineInstr::FrameSetup);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143618.495964.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230209/a6f9be7f/attachment.bin>
More information about the llvm-commits
mailing list