An improvement to IR ValueTracking on Non-negative Integers.
Current IR ValueTracking does not recognize the cases below, thus hiding optimization opportunities.
- Induction variable starting from a non-negative integer and incrementing in each iteration is known to be non-negative.
- Result of left shifting a non-negative integer with nsw flag is known to be non-negative.
This change is a small improvement to computeKnownBits on PHI node and Shift.
Patch by Ruben Perez.
Can this rule be split out into a separate change of its own (with its own tests etc.)?