[PATCH] D98118: GlobalISel: Partially fix handling of byval arguments

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 6 09:02:25 PST 2021


arsenm created this revision.
arsenm added reviewers: paquette, aemerson, bogner, dsanders, aditya_nandakumar.
Herald added subscribers: kerbowa, hiraditya, kristof.beyls, tpr, rovka, nhaehnle, jvesely.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This was essentially ignoring byval and treating them as a pointer
argument which needed to be loaded from. This should copy the frame
index value to the virtual register, not insert a load from the frame
index into the pointer value.

      

For AMDGPU, this was producing a load from the byval pointer argument,
to a pointer used for the byval arguments. I do not understand how
AArch64 managed to work before since it appears to be similarly
broken.

      

We could also change the ValueHandler API to avoid the extra copy from
the frame index, since currently it returns a new register.

      

I believe there is still an issue with outgoing byval arguments. These
should have a copy inserted in case the callee decided to overwrite
the memory.


https://reviews.llvm.org/D98118

Files:
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call-sret.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-function-args.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98118.328770.patch
Type: text/x-patch
Size: 25939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210306/6f84373a/attachment.bin>


More information about the llvm-commits mailing list