[all-commits] [llvm/llvm-project] 9465ef: [mlir][tblgen] Fix bug when mixing props and Infer...
Fabian Mora via All-commits
all-commits at lists.llvm.org
Wed Sep 10 05:08:24 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9465ef54067625cfbcd0dcbb0ab2991a974d51e3
https://github.com/llvm/llvm-project/commit/9465ef54067625cfbcd0dcbb0ab2991a974d51e3
Author: Fabian Mora <fmora.dev at gmail.com>
Date: 2025-09-10 (Wed, 10 Sep 2025)
Changed paths:
M mlir/include/mlir/TableGen/Operator.h
M mlir/lib/TableGen/Operator.cpp
M mlir/test/mlir-tblgen/op-decl-and-defs.td
M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Log Message:
-----------
[mlir][tblgen] Fix bug when mixing props and InferTypes (#157367)
This patch fixes a bug occurring when properties are mixed with any of
the InferType traits, causing tblgen to crash. A simple reproducer is:
```
def _TypeInferredPropOp : NS_Op<"type_inferred_prop_op_with_properties", [
AllTypesMatch<["value", "result"]>
]> {
let arguments = (ins Property<"unsigned">:$prop, AnyType:$value);
let results = (outs AnyType:$result);
let hasCustomAssemblyFormat = 1;
}
```
The issue occurs because of the call:
```
op.getArgToOperandOrAttribute(infer.getIndex());
```
To understand better the issue, consider:
```
attrOrOperandMapping = [Operand0]
arguments = [Prop0, Operand0]
```
In this case, `infer.getIndex()` will return `1` for `Operand0`, but
`getArgToOperandOrAttribute` expects `0`, causing the discrepancy that
causes the crash.
The fix is to change `attrOrOperandMapping` to also include props.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list