Value Range Optimization
While the value of a variable may not be known or may vary, the possible range of values may be known, and can be used to perform optimizations.
Example:
In the code fragment below, the value of i is known to be in the range 1 to 99 inclusive. The IF expression is known to evaluate to true, and the IF test can be eliminated.
for (i = 1; i < 100; i++) { if (i) g (); }
In the code fragment below, the IF expression has been eliminated.
for (i = 1; i < 100; i++) { g (); }
Notes:
Value range optimization is not commonly supported in production C compilers.