On 02/05/2017 04:06 PM, kugan wrote:
Hi Jeff,
On 05/02/17 01:52, Jeff Law wrote:
+ /* EXACT_DIV_EXPR is typically used for pointer subtraction;
+ as a result a ~[0,0] may be better than what has already
+ been computed.
+
+ In particular if numerator has the range ~[0,0], then the
+ result range is going to be something like
+ [MININT/DIVISOR,MAXINT/DIVISOR], which is rarely useful.
+
+ So instead make the result range ~[0,0]. */
+ if (code == EXACT_DIV_EXPR
+ && TREE_CODE (op0) == SSA_NAME
+ && vr0.type == VR_ANTI_RANGE
+ && vr0.min == vr0.max
+ && integer_zerop (vr0.min))
+ set_value_range_to_nonnull (vr, TREE_TYPE (op0));
Just wondering if this has to be done only for POINTER_TYPE_P (TREE_TYPE
(op))? Or is EXACT_DIV_EXPR always of POINTER_TYPE_P?
It can be done regardless of the type -- it just happens that
EXACT_DIV_EXPR is primarily used on pointer types for pointer subtraction.
jeff