]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-pr23128.patch
- fix "could not split insn" with "-O1 -ffast-math".
[packages/gcc.git] / gcc-pr23128.patch
CommitLineData
692b5caf
PS
1--- gcc/gcc/tree-vrp.c 29 Jul 2005 15:21:54 -0000 2.47
2+++ gcc/gcc/tree-vrp.c 30 Jul 2005 18:10:26 -0000
3@@ -908,7 +908,7 @@ vrp_int_const_binop (enum tree_code code
4 {
5 tree res;
6
7- if (flag_wrapv)
8+ if (flag_wrapv || TYPE_UNSIGNED (TREE_TYPE (val1)))
9 return int_const_binop (code, val1, val2, 0);
10
11 /* If we are not using wrapping arithmetic, operate symbolically
12@@ -1095,6 +1095,22 @@ extract_range_from_binary_expr (value_ra
13 the same end of each range. */
14 min = vrp_int_const_binop (code, vr0.min, vr1.min);
15 max = vrp_int_const_binop (code, vr0.max, vr1.max);
16+
17+ /* Check for possible unsigned wrapping. */
18+ if (code == PLUS_EXPR && TYPE_UNSIGNED (TREE_TYPE (expr)))
19+ {
20+ tree res0 = fold_binary_to_constant (GT_EXPR, TREE_TYPE (expr),
21+ vr0.max, max);
22+ tree res1 = fold_binary_to_constant (GT_EXPR, TREE_TYPE (expr),
23+ vr1.max, max);
24+
25+ if ((res0 && integer_onep (res0))
26+ || (res1 && integer_onep (res1)))
27+ {
28+ set_value_range_to_varying (vr);
29+ return;
30+ }
31+ }
32 }
33 else if (code == MULT_EXPR
34 || code == TRUNC_DIV_EXPR
692b5caf
PS
35@@ -1204,6 +1221,22 @@ extract_range_from_binary_expr (value_ra
36 each range. */
37 min = vrp_int_const_binop (code, vr0.min, vr1.max);
38 max = vrp_int_const_binop (code, vr0.max, vr1.min);
39+
40+ /* Check for possible unsigned wrapping. */
41+ if (TYPE_UNSIGNED (TREE_TYPE (expr)))
42+ {
43+ tree res0 = fold_binary_to_constant (LT_EXPR, TREE_TYPE (expr),
44+ vr0.min, min);
45+ tree res1 = fold_binary_to_constant (GT_EXPR, TREE_TYPE (expr),
46+ vr1.max, max);
47+
48+ if ((res0 && integer_onep (res0))
49+ || (res1 && integer_onep (res1)))
50+ {
51+ set_value_range_to_varying (vr);
52+ return;
53+ }
54+ }
55 }
56 else
57 gcc_unreachable ();
58@@ -1677,6 +1710,10 @@ compare_ranges (enum tree_code comp, val
59 else if (cmp_min != -2 && cmp_max != -2)
60 return boolean_false_node;
61 }
62+ /* If [V0_MIN, V1_MAX] < [V1_MIN, V1_MAX] then V0 != V1. */
63+ else if (compare_values (vr0->min, vr1->max) == 1
64+ || compare_values (vr1->min, vr0->max) == 1)
65+ return boolean_false_node;
66
67 return NULL_TREE;
68 }
This page took 0.031795 seconds and 4 git commands to generate.