Commit 4abff4d
authored
[mlir][Transforms] Improve
This commit adds an additional overload to `replaceOpWithMultiple` that
accepts additional container types. This has been brought up by users of
the new `replaceOpWithMultiple` API.
In particular, one missing container type was
`SmallVector<SmallVector<Value>>`. The "default" `ArrayRef<ValueRange>`
container type can lead to use-after-scope errors in cases such as:
```c++
// Compute the replacement value ranges. Some replacements are single
// values, some are value ranges.
SmallVector<ValueRange> repl;
repl.push_back(someValueRange); // OK
for (...) {
// push_back(Value) triggers an implicit conversion to ValueRange,
// which does not own the range.
repl.push_back(someValue); // triggers use-after-scope later
}
rewriter.replaceOpWithMultiple(op, repl);
```
In this example, users should use `SmallVector<SmallVector<Value>>
repl;`.replaceOpWithMultiple API (llvm#132608)1 parent 33cd00f commit 4abff4d
File tree
4 files changed
+53
-19
lines changed- mlir
- include/mlir/Transforms
- lib
- Dialect/SparseTensor/Transforms
- Transforms/Utils
- test/lib/Dialect/Test
4 files changed
+53
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
901 | 912 | | |
902 | 913 | | |
903 | 914 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
620 | | - | |
| 619 | + | |
621 | 620 | | |
622 | 621 | | |
623 | 622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
| |||
946 | 950 | | |
947 | 951 | | |
948 | 952 | | |
949 | | - | |
| 953 | + | |
| 954 | + | |
950 | 955 | | |
951 | 956 | | |
952 | 957 | | |
| |||
1519 | 1524 | | |
1520 | 1525 | | |
1521 | 1526 | | |
1522 | | - | |
| 1527 | + | |
1523 | 1528 | | |
1524 | 1529 | | |
1525 | 1530 | | |
| |||
1561 | 1566 | | |
1562 | 1567 | | |
1563 | 1568 | | |
1564 | | - | |
| 1569 | + | |
1565 | 1570 | | |
1566 | 1571 | | |
1567 | 1572 | | |
| |||
1639 | 1644 | | |
1640 | 1645 | | |
1641 | 1646 | | |
1642 | | - | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
1647 | | - | |
1648 | | - | |
1649 | | - | |
1650 | | - | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1651 | 1652 | | |
1652 | 1653 | | |
1653 | 1654 | | |
1654 | | - | |
| 1655 | + | |
1655 | 1656 | | |
1656 | 1657 | | |
1657 | 1658 | | |
1658 | 1659 | | |
1659 | 1660 | | |
1660 | 1661 | | |
1661 | | - | |
| 1662 | + | |
1662 | 1663 | | |
1663 | 1664 | | |
1664 | 1665 | | |
1665 | 1666 | | |
1666 | 1667 | | |
1667 | 1668 | | |
1668 | 1669 | | |
1669 | | - | |
1670 | | - | |
| 1670 | + | |
| 1671 | + | |
1671 | 1672 | | |
1672 | 1673 | | |
1673 | 1674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1281 | 1304 | | |
1282 | 1305 | | |
1283 | 1306 | | |
| |||
0 commit comments