MLton

RedundantTests is an optimization pass for the SSA IntermediateLanguage, invoked from SSASimplify.

Description

This pass simplifies conditionals whose results are implied by a previous conditional test.

Implementation

Details and Notes

An additional test will sometimes eliminate the overflow test when adding or subtracting 1. In particular, it will eliminate it in the following cases:

if x < y
  then ... x + 1 ...
else ... y - 1 ...