[Mlir-commits] [mlir] b096ac9 - [MLIR] Improve debug messages in BuiltinTypes

Geoffrey Martin-Noble llvmlistbot at llvm.org
Wed Oct 6 09:42:20 PDT 2021


Author: Geoffrey Martin-Noble
Date: 2021-10-06T09:42:13-07:00
New Revision: b096ac909288bbf9f34f3e56934ce0842b59dd96

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

LOG: [MLIR] Improve debug messages in BuiltinTypes

It's nice for users to have more information when debugging failures and
these are only triggered in a failure path.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D107676

Added: 
    

Modified: 
    mlir/lib/IR/BuiltinTypes.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index 3589ed1fe90d..a87dd55d8b26 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -445,10 +445,14 @@ LogicalResult VectorType::verify(function_ref<InFlightDiagnostic()> emitError,
     return emitError() << "vector types must have at least one dimension";
 
   if (!isValidElementType(elementType))
-    return emitError() << "vector elements must be int/index/float type";
+    return emitError()
+           << "vector elements must be int/index/float type but got "
+           << elementType;
 
   if (any_of(shape, [](int64_t i) { return i <= 0; }))
-    return emitError() << "vector types must have positive constant sizes";
+    return emitError()
+           << "vector types must have positive constant sizes but got "
+           << shape;
 
   return success();
 }


        


More information about the Mlir-commits mailing list