diff --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp --- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp @@ -1062,6 +1062,11 @@ return root; } + if (isa(constant)) { + return emitError(loc) + << "blockaddress is not implemented in the LLVM dialect"; + } + return emitError(loc) << "unhandled constant: " << diag(*constant); } diff --git a/mlir/test/Target/LLVMIR/Import/import-failure.ll b/mlir/test/Target/LLVMIR/Import/import-failure.ll --- a/mlir/test/Target/LLVMIR/Import/import-failure.ll +++ b/mlir/test/Target/LLVMIR/Import/import-failure.ll @@ -22,7 +22,7 @@ ; // ----- ; CHECK: import-failure.ll -; CHECK-SAME: error: unhandled constant: ptr blockaddress(@unhandled_constant, %bb1) +; CHECK-SAME: error: blockaddress is not implemented in the LLVM dialect ; CHECK: import-failure.ll ; CHECK-SAME: error: unhandled instruction: ret ptr blockaddress(@unhandled_constant, %bb1) define ptr @unhandled_constant() { @@ -33,7 +33,7 @@ ; // ----- ; CHECK: import-failure.ll -; CHECK-SAME: error: unhandled constant: ptr blockaddress(@unhandled_global, %bb1) +; CHECK-SAME: error: blockaddress is not implemented in the LLVM dialect ; CHECK: import-failure.ll ; CHECK-SAME: error: unhandled global variable: @private = private global ptr blockaddress(@unhandled_global, %bb1) @private = private global ptr blockaddress(@unhandled_global, %bb1)