[PATCH] D50400: AMDGPU: Error more gracefully on libcalls

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 11:25:25 PDT 2018


arsenm created this revision.
arsenm added a reviewer: rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl.

I think this is the only situation where the callsite
will have a null instruction.


https://reviews.llvm.org/D50400

Files:
  lib/Target/AMDGPU/SIISelLowering.cpp
  test/CodeGen/AMDGPU/div_i128.ll


Index: test/CodeGen/AMDGPU/div_i128.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AMDGPU/div_i128.ll
@@ -0,0 +1,7 @@
+; RUN: not llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs  %s 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: unsupported libcall legalization
+define i128 @v_sdiv_i128_vv(i128 %lhs, i128 %rhs) {
+  %shl = sdiv i128 %lhs, %rhs
+  ret i128 %shl
+}
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -2386,6 +2386,9 @@
                               "unsupported call to variadic function ");
   }
 
+  if (!CLI.CS.getInstruction())
+    report_fatal_error("unsupported libcall legalization");
+
   if (!CLI.CS.getCalledFunction()) {
     return lowerUnhandledCall(CLI, InVals,
                               "unsupported indirect call to function ");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50400.159558.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180807/679d6fb8/attachment.bin>


More information about the llvm-commits mailing list