[RISCV] Fix a crash when lowering split float arguments
authorFraser Cormack <fraser@codeplay.com>
Thu, 20 May 2021 16:28:45 +0000 (17:28 +0100)
committerFraser Cormack <fraser@codeplay.com>
Thu, 22 Jul 2021 08:55:26 +0000 (09:55 +0100)
commitb115c038d2d4de15e240d15c6770df5c496b60b6
tree960139deadc35524dd07fd3f9612bc6bc3285170
parent7b3a69bc16515b0b28c520fba0fe0f51fcd3ea33
[RISCV] Fix a crash when lowering split float arguments

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.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D102852
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/calling-conv-vector-float.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/fastcc-float.ll