Commit c0cba25
authored
[mlir][Transforms] Dialect conversion: Hardening
This commit adds extra checks/assertions to the
`ConversionPatternRewriterImpl::notifyOpReplaced` to improve its
robustness.
1. Replacing an `unrealized_conversion_cast` op that was created by the
driver is now forbidden and caught early during `replaceOp`. It may work
in some cases, but it is generally dangerous because the conversion
driver keeps track of these ops and performs some extra legalization
steps during the "finalize" phase. (Erasing is them is fine.)
2. `null` replacement values are no longer registered in the
`ConversionValueMapping`. This was an oversight in #106760. There is no
benefit in having `null` values in the `ConversionValueMapping`. (It may
even cause problems.)
This change is in preparation of merging the 1:1 and 1:N dialect
conversion drivers.replaceOp (#109540)1 parent e19a5fc commit c0cba25
1 file changed
+23
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1382 | 1382 | | |
1383 | 1383 | | |
1384 | 1384 | | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
1385 | 1392 | | |
1386 | 1393 | | |
1387 | 1394 | | |
1388 | 1395 | | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1395 | 1400 | | |
1396 | 1401 | | |
1397 | 1402 | | |
| |||
1400 | 1405 | | |
1401 | 1406 | | |
1402 | 1407 | | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
1403 | 1417 | | |
1404 | 1418 | | |
1405 | | - | |
1406 | | - | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
1407 | 1422 | | |
1408 | 1423 | | |
1409 | 1424 | | |
| |||
0 commit comments