| 1 |
= RedundantTests |
| 2 |
|
| 3 |
<<RedundantTests#>> is an optimization pass for the <<SSA#>> |
| 4 |
<<IntermediateLanguage#>>, invoked from <<SSASimplify#>>. |
| 5 |
|
| 6 |
== Description |
| 7 |
|
| 8 |
This pass simplifies conditionals whose results are implied by a |
| 9 |
previous conditional test. |
| 10 |
|
| 11 |
== Implementation |
| 12 |
|
| 13 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/redundant-tests.fun[`redundant-tests.fun`] |
| 14 |
|
| 15 |
== Details and Notes |
| 16 |
|
| 17 |
An additional test will sometimes eliminate the overflow test when |
| 18 |
adding or subtracting 1. In particular, it will eliminate it in the |
| 19 |
following cases: |
| 20 |
[source,sml] |
| 21 |
---- |
| 22 |
if x < y |
| 23 |
then ... x + 1 ... |
| 24 |
else ... y - 1 ... |
| 25 |
---- |