[PATCH] D102852: [RISCV] Fix a crash when lowering split float arguments

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 09:54:38 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: asb, luismarques, craig.topper.
Herald added subscribers: vkmr, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Lowering certain float vectors without legal vector types could cause a
crash due to a bad interaction between passing floats via GPRs and
argument splitting. Split vector floats appear just like scalar floats.
Under certain situations we choose to pass these float arguments via
GPRs and use an XLenVT location and set the 'BCvt' info to track how
they must be converted back to floating-point values. However, later
logic for handling split arguments may take over, in which case we lose
the previous information and set the 'Indirect' info, thus incorrectly
lowering to integer types.

I don't believe that we would have come across the notion of split
floating-point arguments before. This patch addresses the issue by
updating the lowering so that split arguments are only passed indirectly
when they are scalar integer types.

This has some change to how we lower some larger illegal float vectors,
as can be seen in 'fastcc-float.ll' where the vector is now passed
partly in registers and partly on the stack. The register arguments seem
to occupy unused stack slots, which I've observed in other vector tests.
This may require investigation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102852

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/calling-conv-vector-float.ll
  llvm/test/CodeGen/RISCV/fastcc-float.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102852.346770.patch
Type: text/x-patch
Size: 6465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210520/79c86e25/attachment.bin>


More information about the llvm-commits mailing list