Improve Value Range Bound Snapping During Pair Construction
Bounds are now snapped during pair construction to improve value range accuracy.
This commit improves the accuracy of value range analysis by integrating bound snapping directly into the pair construction process. Instead of building all pairs and then applying a mask, the mask is now applied to each pair as it is constructed. This change results in tighter and more accurate value ranges, which can lead to better optimization.
In Details
This commit modifies irange::intersect in value-range.cc to snap bounds during pair construction. Instead of applying the mask afterwards, it's applied during creation. This tightens the ranges earlier in the process.
For Context
Value range analysis helps the compiler determine the possible values of variables and expressions. This information can be used to optimize code, for instance, by eliminating unnecessary checks. This commit improves how the value ranges are calculated by making the process more precise from the beginning. This can lead to the compiler generating faster and more efficient code.