Skip to content

Commit 768a517

Browse files
committed
[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.
1 parent 178da37 commit 768a517

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir/tools/mlir-tblgen/RewriterGen.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,14 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
12951295
childNodeNames.lookup(argIndex));
12961296
} else {
12971297
DagLeaf leaf = node.getArgAsLeaf(argIndex);
1298+
if (leaf.isConstantAttr())
1299+
// TODO: Use better location
1300+
PrintFatalError(
1301+
loc,
1302+
"attribute found where value was expected, if attempting to use "
1303+
"constant value, construct a constant op with given attribute "
1304+
"instead");
1305+
12981306
auto symbol =
12991307
symbolInfoMap.getValueAndRangeUse(node.getArgName(argIndex));
13001308
if (leaf.isNativeCodeCall()) {

0 commit comments

Comments
 (0)