[PATCH] D83417: GlobalISel: Restructure argument lowering loop in handleAssignments

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 12:30:26 PDT 2020


arsenm created this revision.
arsenm added reviewers: aemerson, paquette, rovka, aditya_nandakumar, dsanders.
Herald added subscribers: hiraditya, kristof.beyls, tpr, wdng.
Herald added a project: LLVM.

This was structured in a way that implied every split argument is in
memory, or in registers. It is possible for a pass a original argument
partially in registers, and partially in memory. Transpose the logic
here to only consider a single piece at a time. Every individual
CCValAssign should be treated independently, and any merge to original
value needs to be handled later.

      

This is in preparation for merging some preprocessing hacks in the
AMDGPU calling convention lowering into the generic code. This was
intended to be NFC, but it does partially address a FIXME in the
memloc handling.

      

As a result, this does slightly change AArch64 handling of some
promoted arguments passed on the stack. The store will be emitted as
the smaller, piece type rather than a wider store of an anyext
value. I think this exposes a failure to merge stores later, as the
change in swifterror replaces a single 64-bit stp with 2 4-byte str.

      

I'm also not sure what the correct behavior for memlocs where the
promoted size is larger than the original value. I've opted to clamp
the memory access size to not exceed the value register to avoid the
explicit trunc/extend/vector widen/vector extract instruction. This
happens for AMDGPU for i8 arguments that end up stack passed, which
are promoted to i16 (I think this is a preexisting DAG bug though, and
they should not really be promoted when in memory).


https://reviews.llvm.org/D83417

Files:
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/arm64-callingconv-ios.ll
  llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
  llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-i128-on-stack.ll
  llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll
  llvm/test/CodeGen/AArch64/GlobalISel/swifterror.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83417.276524.patch
Type: text/x-patch
Size: 13226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/b2c78d08/attachment.bin>


More information about the llvm-commits mailing list