mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 07:27:33 +08:00
[mlir-translate] More specific error message for BlockAddress
BlockAddress is currently unimplemented in the LLVM dialect of MLIR; when converting to LLVM dialect MLIR from LLVM IR, mlir-translate currently terminates with an "unhandled constant" error message. Instead, this message could be made more specific, to let the user know that the specific issue is that BlockAddress is unimplemented in the LLVM dialect. Differential Revision: https://reviews.llvm.org/D142337
This commit is contained in:
committed by
Min-Yih Hsu
parent
46013fc10a
commit
ca5e2e3aaa
@@ -1062,6 +1062,11 @@ FailureOr<Value> ModuleImport::convertConstant(llvm::Constant *constant) {
|
||||
return root;
|
||||
}
|
||||
|
||||
if (isa<llvm::BlockAddress>(constant)) {
|
||||
return emitError(loc)
|
||||
<< "blockaddress is not implemented in the LLVM dialect";
|
||||
}
|
||||
|
||||
return emitError(loc) << "unhandled constant: " << diag(*constant);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ define i32 @unhandled_value(i32 %arg1) {
|
||||
; // -----
|
||||
|
||||
; 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 @@ bb1:
|
||||
; // -----
|
||||
|
||||
; 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)
|
||||
|
||||
Reference in New Issue
Block a user