[PATCH] D146331: [NVPTX] Report fatal error on empty argument type.

Pavel Kopyl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 17:28:34 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7adacaa098d9: [NVPTX] Report fatal error on empty argument type. (authored by pavelkopyl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146331/new/

https://reviews.llvm.org/D146331

Files:
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/test/CodeGen/NVPTX/empty-type.ll


Index: llvm/test/CodeGen/NVPTX/empty-type.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/NVPTX/empty-type.ll
@@ -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
+}
Index: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -2666,7 +2666,9 @@
         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 @@
       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));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146331.506245.patch
Type: text/x-patch
Size: 1575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230318/36dc3738/attachment.bin>


More information about the llvm-commits mailing list