[MLIR] Don't verify call signature for indirect opaque ptr call
authorNikita Popov <npopov@redhat.com>
Tue, 17 Jan 2023 09:53:22 +0000 (10:53 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 17 Jan 2023 09:55:04 +0000 (10:55 +0100)
Fixes a crash when converting the instructions.ll test to opaque
pointers.

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/test/Target/LLVMIR/Import/instructions.ll

index 54cdf98..5be597c 100644 (file)
@@ -1199,6 +1199,10 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
     if (!ptrType)
       return emitOpError("indirect call expects a pointer as callee: ")
              << ptrType;
+
+    if (ptrType.isOpaque())
+      return success();
+
     fnType = ptrType.getElementType();
   } else {
     Operation *callee =
index bd44c28..cb72566 100644 (file)
@@ -427,7 +427,7 @@ define float @call_fn(i32 %arg1) {
 
 ; CHECK-LABEL: @call_fn_ptr
 ; CHECK-SAME:  %[[PTR:[a-zA-Z0-9]+]]
-define void @call_fn_ptr(void (i16) *%fn) {
+define void @call_fn_ptr(ptr %fn) {
   ; CHECK:  %[[C0:[0-9]+]] = llvm.mlir.constant(0 : i16) : i16
   ; CHECK:  llvm.call %[[PTR]](%[[C0]])
   call void %fn(i16 0)