[NVPTX] Report fatal error on empty argument type.

Differential Revision: https://reviews.llvm.org/D146331
This commit is contained in:
Pavel Kopyl 2023-03-16 03:01:50 +01:00
parent 93c1a5f3dd
commit 7adacaa098
2 changed files with 16 additions and 2 deletions

View File

@ -2666,7 +2666,9 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
SmallVector<EVT, 16> vtparts;
ComputePTXValueVTs(*this, DAG.getDataLayout(), Ty, vtparts);
assert(vtparts.size() > 0 && "empty aggregate type not expected");
if (vtparts.empty())
report_fatal_error("Empty parameter types are not supported");
for (unsigned parti = 0, parte = vtparts.size(); parti != parte;
++parti) {
InVals.push_back(DAG.getNode(ISD::UNDEF, dl, Ins[InsIdx].VT));
@ -2703,7 +2705,9 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
SmallVector<EVT, 16> VTs;
SmallVector<uint64_t, 16> Offsets;
ComputePTXValueVTs(*this, DL, Ty, VTs, &Offsets, 0);
assert(VTs.size() > 0 && "Unexpected empty type.");
if (VTs.empty())
report_fatal_error("Empty parameter types are not supported");
auto VectorInfo =
VectorizePTXValueVTs(VTs, Offsets, DL.getABITypeAlign(Ty));

View File

@ -0,0 +1,10 @@
; RUN: not --crash llc < %s -march=nvptx -mcpu=sm_20 2>&1 | FileCheck %s
%struct.A = type { [0 x float] }
%struct.B = type { i32, i32 }
; CHECK: ERROR: Empty parameter types are not supported
define void @kernel(%struct.A %a, %struct.B %b) {
entry:
ret void
}