Commit 310a278
authored
[mlir][Transforms][NFC] Simplify handling of erased IR (#83423)
The dialect conversion uses a `SingleEraseRewriter` to ensure that an
op/block is not erased twice. This can happen during the "commit" phase
when an unresolved materialization is inserted into a block and the
enclosing op is erased by the user. In that case, the unresolved
materialization should not be erased a second time later in the "commit"
phase.
This problem cannot happen during "rollback", so ops/block can be erased
directly without using the rewriter. With this change, the
`SingleEraseRewriter` is used only during "commit"/"cleanup". At that
point, the dialect conversion is guaranteed to succeed and no rollback
can happen. Therefore, it is not necessary to store the number of erased
IR objects (because we will never "reset" the rewriter to previous a
previous state).1 parent 71c2a13 commit 310a278
1 file changed
+8
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 166 | | |
170 | 167 | | |
171 | 168 | | |
| |||
274 | 271 | | |
275 | 272 | | |
276 | 273 | | |
| 274 | + | |
277 | 275 | | |
278 | | - | |
| 276 | + | |
279 | 277 | | |
280 | 278 | | |
281 | 279 | | |
| |||
905 | 903 | | |
906 | 904 | | |
907 | 905 | | |
908 | | - | |
| 906 | + | |
909 | 907 | | |
910 | 908 | | |
911 | 909 | | |
| |||
1091 | 1089 | | |
1092 | 1090 | | |
1093 | 1091 | | |
1094 | | - | |
| 1092 | + | |
1095 | 1093 | | |
1096 | 1094 | | |
1097 | 1095 | | |
1098 | 1096 | | |
1099 | 1097 | | |
1100 | 1098 | | |
1101 | 1099 | | |
1102 | | - | |
| 1100 | + | |
1103 | 1101 | | |
1104 | 1102 | | |
1105 | 1103 | | |
| |||
1116 | 1114 | | |
1117 | 1115 | | |
1118 | 1116 | | |
1119 | | - | |
1120 | | - | |
| 1117 | + | |
1121 | 1118 | | |
1122 | 1119 | | |
1123 | 1120 | | |
| |||
1128 | 1125 | | |
1129 | 1126 | | |
1130 | 1127 | | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | 1128 | | |
1135 | 1129 | | |
1136 | 1130 | | |
| |||
0 commit comments