Skip to content

Commit

Permalink
[mlir][llvm] Keep unhandled constant test.
Browse files Browse the repository at this point in the history
Add the more precise error message introduced in
https://reviews.llvm.org/D142337 to the standard
error produced for unhandled constants. This way
we keep testing both error cases.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D147205
  • Loading branch information
gysit committed Mar 31, 2023
1 parent fce093c commit 8ac014a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions mlir/lib/Target/LLVMIR/ModuleImport.cpp
Expand Up @@ -1118,12 +1118,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";
}
StringRef error = "";
if (isa<llvm::BlockAddress>(constant))
error = " since blockaddress(...) is unsupported";

return emitError(loc) << "unhandled constant: " << diag(*constant);
return emitError(loc) << "unhandled constant: " << diag(*constant) << error;
}

FailureOr<Value> ModuleImport::convertConstantExpr(llvm::Constant *constant) {
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Target/LLVMIR/Import/import-failure.ll
Expand Up @@ -22,7 +22,7 @@ define i32 @unhandled_value(i32 %arg1) {
; // -----

; CHECK: import-failure.ll
; CHECK-SAME: error: blockaddress is not implemented in the LLVM dialect
; CHECK-SAME: unhandled constant: ptr blockaddress(@unhandled_constant, %bb1) since blockaddress(...) is unsupported
; CHECK: import-failure.ll
; CHECK-SAME: error: unhandled instruction: ret ptr blockaddress(@unhandled_constant, %bb1)
define ptr @unhandled_constant() {
Expand All @@ -34,7 +34,7 @@ bb1:
; // -----

; CHECK: import-failure.ll
; CHECK-SAME: error: blockaddress is not implemented in the LLVM dialect
; CHECK-SAME: unhandled constant: ptr blockaddress(@unhandled_global, %bb1) since blockaddress(...) is unsupported
; 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)
Expand Down

0 comments on commit 8ac014a

Please sign in to comment.