Commit 9465ef5
authored
[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.1 parent 3327a4c commit 9465ef5
File tree
4 files changed
+42
-28
lines changed- mlir
- include/mlir/TableGen
- lib/TableGen
- test/mlir-tblgen
- tools/mlir-tblgen
4 files changed
+42
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
331 | 332 | | |
332 | | - | |
333 | | - | |
| 333 | + | |
| 334 | + | |
334 | 335 | | |
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
339 | | - | |
340 | | - | |
| 340 | + | |
| 341 | + | |
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
| |||
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | | - | |
409 | | - | |
| 409 | + | |
| 410 | + | |
410 | 411 | | |
411 | 412 | | |
412 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| |||
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
666 | | - | |
667 | | - | |
| 667 | + | |
| 668 | + | |
668 | 669 | | |
669 | 670 | | |
670 | | - | |
671 | | - | |
| 671 | + | |
| 672 | + | |
672 | 673 | | |
673 | 674 | | |
674 | 675 | | |
| 676 | + | |
| 677 | + | |
675 | 678 | | |
676 | 679 | | |
677 | 680 | | |
| |||
867 | 870 | | |
868 | 871 | | |
869 | 872 | | |
870 | | - | |
871 | | - | |
872 | | - | |
| 873 | + | |
| 874 | + | |
873 | 875 | | |
874 | 876 | | |
875 | 877 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3849 | 3849 | | |
3850 | 3850 | | |
3851 | 3851 | | |
3852 | | - | |
3853 | | - | |
3854 | | - | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
3855 | 3855 | | |
3856 | 3856 | | |
3857 | 3857 | | |
| |||
3877 | 3877 | | |
3878 | 3878 | | |
3879 | 3879 | | |
3880 | | - | |
3881 | | - | |
3882 | | - | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
3883 | 3883 | | |
3884 | 3884 | | |
3885 | 3885 | | |
3886 | 3886 | | |
3887 | 3887 | | |
3888 | | - | |
3889 | | - | |
3890 | | - | |
| 3888 | + | |
| 3889 | + | |
3891 | 3890 | | |
3892 | 3891 | | |
3893 | 3892 | | |
| |||
3907 | 3906 | | |
3908 | 3907 | | |
3909 | 3908 | | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
3910 | 3912 | | |
3911 | 3913 | | |
3912 | 3914 | | |
| |||
0 commit comments