Commit f3fb4cc
committed
[mlir][arith] Canonicalize sitofp(truncf) -> sitofp, or uitofp.
Add a canonicalization pattern that simplifies `truncf(sitofp(x))` to
`sitofp(x)`.
This assumes that the destination type of truncf is representable by the source type.
Note that the truncf semantics requires that the destination type is narrower than
the source type, so this is true for all fp types I can possibly think of, but one
could probably construct a artificial counter example.1 parent 2d287f5 commit f3fb4cc
File tree
4 files changed
+30
-0
lines changed- mlir
- include/mlir/Dialect/Arith/IR
- lib/Dialect/Arith/IR
- test/Dialect/Arith
4 files changed
+30
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1273 | 1273 | | |
1274 | 1274 | | |
1275 | 1275 | | |
| 1276 | + | |
1276 | 1277 | | |
1277 | 1278 | | |
1278 | 1279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
422 | 436 | | |
423 | 437 | | |
424 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1552 | 1552 | | |
1553 | 1553 | | |
1554 | 1554 | | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1555 | 1560 | | |
1556 | 1561 | | |
1557 | 1562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
756 | 766 | | |
757 | 767 | | |
758 | 768 | | |
| |||
0 commit comments