Index: mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp =================================================================== --- mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp +++ mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp @@ -49,6 +49,8 @@ // LLVM container types may (recursively) contain other types that must be // converted even when the outer type is compatible. addConversion([&](LLVM::LLVMPointerType type) -> llvm::Optional { + if (type.isOpaque()) + return type; if (auto pointee = convertType(type.getElementType())) return LLVM::LLVMPointerType::get(pointee, type.getAddressSpace()); return llvm::None; Index: mlir/test/Conversion/FuncToLLVM/convert-types.mlir =================================================================== --- mlir/test/Conversion/FuncToLLVM/convert-types.mlir +++ mlir/test/Conversion/FuncToLLVM/convert-types.mlir @@ -4,6 +4,11 @@ // CHECK: !llvm.ptr func.func private @ptr() -> !llvm.ptr +// CHECK-LABEL: @opaque_ptr +// CHECK: !llvm.ptr +// CHECK-NOT: < +func.func private @opaque_ptr() -> !llvm.ptr + // CHECK-LABEL: @ptr_ptr() // CHECK: !llvm.ptr> func.func private @ptr_ptr() -> !llvm.ptr>