[Mlir-commits] [mlir] 35bd419 - [mlir] Add assert to fail with more info (NFC)
Jacques Pienaar
llvmlistbot at llvm.org
Thu Apr 14 19:54:18 PDT 2022
Author: Jacques Pienaar
Date: 2022-04-14T19:54:12-07:00
New Revision: 35bd41916b10a9312ec33e90580497bc4c7f22fe
URL: https://github.com/llvm/llvm-project/commit/35bd41916b10a9312ec33e90580497bc4c7f22fe
DIFF: https://github.com/llvm/llvm-project/commit/35bd41916b10a9312ec33e90580497bc4c7f22fe.diff
LOG: [mlir] Add assert to fail with more info (NFC)
This would have assert before during tensor type construction with
opaque error, assert and fail earlier now.
Added:
Modified:
mlir/lib/Interfaces/InferTypeOpInterface.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Interfaces/InferTypeOpInterface.cpp b/mlir/lib/Interfaces/InferTypeOpInterface.cpp
index ff17ed0498bb2..8f29682636f7a 100644
--- a/mlir/lib/Interfaces/InferTypeOpInterface.cpp
+++ b/mlir/lib/Interfaces/InferTypeOpInterface.cpp
@@ -191,6 +191,8 @@ LogicalResult mlir::detail::inferReturnTensorTypes(
return failure();
for (const auto &shapeAndType : retComponents) {
assert(shapeAndType.getAttribute() == nullptr && "attribute not supported");
+ assert(shapeAndType.getElementType() &&
+ "element type required to construct tensor");
if (shapeAndType.hasRank())
inferredReturnTypes.push_back(RankedTensorType::get(
shapeAndType.getDims(), shapeAndType.getElementType()));
More information about the Mlir-commits
mailing list