[Mlir-commits] [mlir] 768a517 - [mlir][drr] Improve error message for unexpected attribute (NFC)
Jacques Pienaar
llvmlistbot at llvm.org
Tue Aug 10 13:04:13 PDT 2021
Author: Jacques Pienaar
Date: 2021-08-10T13:03:53-07:00
New Revision: 768a5175819233102d44891bd1c103af09d488a1
URL: https://github.com/llvm/llvm-project/commit/768a5175819233102d44891bd1c103af09d488a1
DIFF: https://github.com/llvm/llvm-project/commit/768a5175819233102d44891bd1c103af09d488a1.diff
LOG: [mlir][drr] Improve error message for unexpected attribute (NFC)
When using an attribute where a value is expected previously this would fail
complaining about unbound symbol. Instead make error clear and mention common
failure reason.
Added:
Modified:
mlir/tools/mlir-tblgen/RewriterGen.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 5913101b86b27..0ef5a57894276 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -1295,6 +1295,14 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
childNodeNames.lookup(argIndex));
} else {
DagLeaf leaf = node.getArgAsLeaf(argIndex);
+ if (leaf.isConstantAttr())
+ // TODO: Use better location
+ PrintFatalError(
+ loc,
+ "attribute found where value was expected, if attempting to use "
+ "constant value, construct a constant op with given attribute "
+ "instead");
+
auto symbol =
symbolInfoMap.getValueAndRangeUse(node.getArgName(argIndex));
if (leaf.isNativeCodeCall()) {
More information about the Mlir-commits
mailing list