[Mlir-commits] [mlir] 8ac014a - [mlir][llvm] Keep unhandled constant test.

Tobias Gysi llvmlistbot at llvm.org
Thu Mar 30 23:17:01 PDT 2023


Author: Tobias Gysi
Date: 2023-03-31T06:08:34Z
New Revision: 8ac014ae0570baeb6ffb870d2c7a26967cb86530

URL: https://github.com/llvm/llvm-project/commit/8ac014ae0570baeb6ffb870d2c7a26967cb86530
DIFF: https://github.com/llvm/llvm-project/commit/8ac014ae0570baeb6ffb870d2c7a26967cb86530.diff

LOG: [mlir][llvm] Keep unhandled constant test.

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

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/ModuleImport.cpp
    mlir/test/Target/LLVMIR/Import/import-failure.ll

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
index 707f28d6c3641..1405606b1f57d 100644
--- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
@@ -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) {

diff  --git a/mlir/test/Target/LLVMIR/Import/import-failure.ll b/mlir/test/Target/LLVMIR/Import/import-failure.ll
index b330f654d3d51..6ad38f80cc6ba 100644
--- a/mlir/test/Target/LLVMIR/Import/import-failure.ll
+++ b/mlir/test/Target/LLVMIR/Import/import-failure.ll
@@ -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() {
@@ -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)


        


More information about the Mlir-commits mailing list