+ else if ((code == TRUNC_DIV_EXPR
+ || code == FLOOR_DIV_EXPR
+ || code == CEIL_DIV_EXPR
+ || code == EXACT_DIV_EXPR
+ || code == ROUND_DIV_EXPR)
+ && (vr0.type != VR_RANGE || symbolic_range_p (&vr0)))
+ {
+ /* For division, if op1 has VR_RANGE but op0 does not, something
+ can be deduced just from that range. Say [min, max] / [4, max]
+ gives [min / 4, max / 4] range. */
+ if (vr1.type == VR_RANGE
+ && !symbolic_range_p (&vr1)
+ && !range_includes_zero_p (&vr1))
+ {
+ vr0.type = type = VR_RANGE;
+ vr0.min = vrp_val_min (TREE_TYPE (op0));
+ vr0.max = vrp_val_max (TREE_TYPE (op1));
+ }
+ else
+ {
+ set_value_range_to_varying (vr);
+ return;
+ }
+ }
+
+ /* For divisions, if op0 is VR_RANGE, we can deduce a range
+ even if op1 is VR_VARYING, VR_ANTI_RANGE, symbolic or can
+ include 0. */
+ if ((code == TRUNC_DIV_EXPR
+ || code == FLOOR_DIV_EXPR
+ || code == CEIL_DIV_EXPR
+ || code == EXACT_DIV_EXPR
+ || code == ROUND_DIV_EXPR)
+ && vr0.type == VR_RANGE
+ && (vr1.type != VR_RANGE
+ || symbolic_range_p (&vr1)
+ || range_includes_zero_p (&vr1)))
+ {
+ tree zero = build_int_cst (TREE_TYPE (vr0.min), 0);
+ int cmp;
+
+ sop = false;
+ min = NULL_TREE;
+ max = NULL_TREE;
+ if (vrp_expr_computes_nonnegative (op1, &sop) && !sop)
+ {
+ /* For unsigned division or when divisor is known
+ to be non-negative, the range has to cover
+ all numbers from 0 to max for positive max
+ and all numbers from min to 0 for negative min. */
+ cmp = compare_values (vr0.max, zero);
+ if (cmp == -1)
+ max = zero;
+ else if (cmp == 0 || cmp == 1)
+ max = vr0.max;
+ else
+ type = VR_VARYING;
+ cmp = compare_values (vr0.min, zero);
+ if (cmp == 1)
+ min = zero;
+ else if (cmp == 0 || cmp == -1)
+ min = vr0.min;
+ else
+ type = VR_VARYING;
+ }
+ else
+ {
+ /* Otherwise the range is -max .. max or min .. -min
+ depending on which bound is bigger in absolute value,
+ as the division can change the sign. */
+ abs_extent_range (vr, vr0.min, vr0.max);
+ return;
+ }
+ if (type == VR_VARYING)
+ {
+ set_value_range_to_varying (vr);
+ return;
+ }
+ }
+