Commit de80ab1
Automerge: [mlir][Transforms] Dialect conversion: Add support for
This commit adds support for `replaceUsesWithIf` (and variants such as
`replaceAllUsesExcept`) to the `ConversionPatternRewriter`. This API is
supported only in no-rollback mode. An assertion is triggered in
rollback mode. (This missing assertion has been confusing for users
because it seemed that the API supported, while it was actually not
working properly.)
This commit brings us a bit closer towards removing
[this](https://github.com/llvm/llvm-project/blob/76ec25f729fcc7ae576caf21293cc393e68e7cf7/mlir/lib/Transforms/Utils/DialectConversion.cpp#L1214)
workaround.
Additional changes are needed to support this API in rollback mode. In
particular, no entries should be added to the `ConversionValueMapping`
for conditional replacements. It's unclear at this point if this API can
be supported in rollback mode, so this is deferred to later.
This commit turns `replaceUsesWithIf` into a virtual function, so that
the `ConversionPatternRewriter` can override it. All other API functions
for conditional value replacements call that function.
Note for LLVM integration: If you are seeing failed assertions due to
this change, you are using unsupported API in your dialect conversion.
You have 3 options: (1) Migrate to the no-rollback driver. (2) Rewrite
your patterns without the unsupported API. (3) Last resort: bypass the
rewriter and call `replaceUsesWithIf` etc. directly on the `Value`
object.replaceUsesWithIf (#169606)File tree
5 files changed
+107
-29
lines changed- mlir
- include/mlir
- IR
- Transforms
- lib/Transforms/Utils
- test
- Transforms
- lib/Dialect/Test
5 files changed
+107
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
678 | | - | |
679 | | - | |
680 | | - | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
906 | 927 | | |
907 | 928 | | |
908 | 929 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
979 | | - | |
980 | | - | |
981 | | - | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
982 | 985 | | |
983 | 986 | | |
984 | 987 | | |
| |||
1203 | 1206 | | |
1204 | 1207 | | |
1205 | 1208 | | |
1206 | | - | |
1207 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1208 | 1212 | | |
1209 | 1213 | | |
1210 | | - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1211 | 1219 | | |
1212 | 1220 | | |
1213 | 1221 | | |
| |||
1238 | 1246 | | |
1239 | 1247 | | |
1240 | 1248 | | |
1241 | | - | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1242 | 1254 | | |
1243 | 1255 | | |
1244 | 1256 | | |
| |||
1646 | 1658 | | |
1647 | 1659 | | |
1648 | 1660 | | |
1649 | | - | |
| 1661 | + | |
1650 | 1662 | | |
1651 | 1663 | | |
1652 | 1664 | | |
| |||
1655 | 1667 | | |
1656 | 1668 | | |
1657 | 1669 | | |
1658 | | - | |
| 1670 | + | |
1659 | 1671 | | |
1660 | 1672 | | |
1661 | 1673 | | |
1662 | 1674 | | |
1663 | 1675 | | |
1664 | 1676 | | |
1665 | | - | |
| 1677 | + | |
1666 | 1678 | | |
1667 | 1679 | | |
1668 | 1680 | | |
| |||
1962 | 1974 | | |
1963 | 1975 | | |
1964 | 1976 | | |
1965 | | - | |
1966 | | - | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
1967 | 1995 | | |
1968 | 1996 | | |
1969 | 1997 | | |
| |||
1973 | 2001 | | |
1974 | 2002 | | |
1975 | 2003 | | |
1976 | | - | |
| 2004 | + | |
1977 | 2005 | | |
1978 | 2006 | | |
1979 | 2007 | | |
| |||
1992 | 2020 | | |
1993 | 2021 | | |
1994 | 2022 | | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
1995 | 2026 | | |
1996 | 2027 | | |
1997 | 2028 | | |
| |||
2190 | 2221 | | |
2191 | 2222 | | |
2192 | 2223 | | |
2193 | | - | |
2194 | | - | |
2195 | | - | |
2196 | | - | |
2197 | | - | |
2198 | | - | |
2199 | | - | |
2200 | | - | |
2201 | | - | |
2202 | | - | |
2203 | | - | |
2204 | | - | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
2205 | 2233 | | |
2206 | 2234 | | |
2207 | 2235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
980 | | - | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
981 | 987 | | |
982 | 988 | | |
983 | 989 | | |
| |||
0 commit comments