[PATCH] D158272: [AArch64] [GlobalISel] Fix clobbered callee saved registers with win64 varargs

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 05:52:24 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: efriedma, dzhidzhoev.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

This fixes a regression since 1c10d5b175992a9d056a2d763a932e5652386fc1 <https://reviews.llvm.org/rG1c10d5b175992a9d056a2d763a932e5652386fc1>
/ https://reviews.llvm.org/D130903 by applying the same fix from
SelectionDAG from 8cb3667541a94c4fa11b06e19020f753414c1d03 /
https://reviews.llvm.org/D35720.

This could possibly have been detected if the existing testcases
in win64_vararg.ll had been tested with GlobalISel too, but all
the IR snippets there fail to be translated with GlobalISel.

This adds a separate testcase based on real world LLVM IR (instead of
hand-reduced IR), which GlobalISel does translate happily - tested
with both SelectionDAG and GlobalISel.

Before this change, the stack object locations (visible in MIR
with "llc -print-after-all") didn't match with what the prologue
emitted by AArch64FrameLowering actually looked like, which caused
clobbered callee saved registers when function local stack objects
aliased the actual location of the callee saved registers.

This fixes https://github.com/llvm/llvm-project/issues/64740.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158272

Files:
  llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
  llvm/test/CodeGen/AArch64/win64_vararg2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158272.551479.patch
Type: text/x-patch
Size: 4826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230818/890dfb2e/attachment.bin>


More information about the llvm-commits mailing list