Commit d2f3ffba by James A. Morrison

tree-vrp.c (compare_range_with_value): Return true or false for ~[VAL_1...

2005-07-29  James A. Morrison  <phython@gcc.gnu.org>

        * tree-vrp.c (compare_range_with_value): Return true or false
        for ~[VAL_1, VAL_2] OP VAL if VAL_1 <= VAL <= VAL_2 for NE_EXPR and
        EQ_EXPR respectively.

From-SVN: r102558
parent 9e4eb559
2005-07-29 James A. Morrison <phython@gcc.gnu.org>
* tree-vrp.c (compare_range_with_value): Return true or false
for ~[VAL_1, VAL_2] OP VAL if VAL_1 <= VAL <= VAL_2 for NE_EXPR and
EQ_EXPR respectively.
2005-07-29 Kazu Hirata <kazu@codesourcery.com>
* cfg.c, tree-complex.c, config/frv/frv.c, config/i386/i386.c:
......
2005-07-29 James A. Morrison <phython@gcc.gnu.org>
* gcc.dg/tree-ssa/vrp19.c: New test.
* gcc.dg/tree-ssa-vrp20.c: New test.
2005-07-29 Joseph S. Myers <joseph@codesourcery.com>
PR c/22240
......
/* { dg-do compile } */
/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp" } */
#include <limits.h>
extern void abort ();
extern void exit (int);
int f (int a) {
if (a != INT_MIN) {
a = a > 0 ? a : -a;
if (a < 0)
return 1;
}
return 0;
}
int g (int b) {
if (b != INT_MIN) {
b = b > 0 ? b : -b;
if (b >= 0)
return 0;
}
return 1;
}
/* { dg-final { scan-tree-dump "Folding predicate a_. < 0 to 0" "vrp" } } */
/* { dg-final { scan-tree-dump "Folding predicate b_. >= 0 to 1" "vrp" } } */
/* { dg-final { cleanup-tree-dump "vrp" } } */
/* { dg-do compile } */
/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp" } */
extern void abort ();
extern void exit (int);
int f (int a) {
if (a != 0) {
a = a > 0 ? a : -a;
if (a == 0)
return 1;
return 0;
}
return 0;
}
int g (int b) {
if (b != 0) {
b = b > 0 ? b : -b;
if (b != 0)
return 0;
}
return 1;
}
/* { dg-final { scan-tree-dump "Folding predicate a_. == 0 to 0" "vrp" } } */
/* { dg-final { scan-tree-dump "Folding predicate b_. != 0 to 1" "vrp" } } */
/* { dg-final { cleanup-tree-dump "vrp" } } */
......@@ -1753,9 +1753,8 @@ compare_range_with_value (enum tree_code comp, value_range_t *vr, tree val)
|| comp == LE_EXPR)
return NULL_TREE;
/* ~[VAL, VAL] == VAL is always false. */
if (compare_values (vr->min, val) == 0
&& compare_values (vr->max, val) == 0)
/* ~[VAL_1, VAL_2] OP VAL is known if VAL_1 <= VAL <= VAL_2. */
if (value_inside_range (val, vr) == 1)
return (comp == NE_EXPR) ? boolean_true_node : boolean_false_node;
return NULL_TREE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment