diff options
author | Jeff Law <law@redhat.com> | 2011-03-16 11:32:58 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2011-03-16 11:32:58 -0600 |
commit | 6261ab0ee61da61460b541fd877d741f3b8dbd05 (patch) | |
tree | 9ed551087a24fe1b4ebf541c50da971c2db7d7a5 | |
parent | 23d956f9358316e3a65455ff3dc4caffb6b67de3 (diff) | |
download | gcc-6261ab0ee61da61460b541fd877d741f3b8dbd05.zip gcc-6261ab0ee61da61460b541fd877d741f3b8dbd05.tar.gz gcc-6261ab0ee61da61460b541fd877d741f3b8dbd05.tar.bz2 |
tree-vrp.c (identify_jump_threads): Slightly simplify type check for operands of conditional.
* tree-vrp.c (identify_jump_threads): Slightly simplify type
check for operands of conditional. Allow type to be a
pointer.
* gcc.dg/tree-ssa/vrp55.c: New test.
From-SVN: r171055
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp55.c | 14 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 10 |
4 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c19efcb..faf65fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-16 Jeff Law <law@redhat.com> + + * tree-vrp.c (identify_jump_threads): Slightly simplify type + check for operands of conditional. Allow type to be a + pointer. + 2011-03-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/48149 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 649dc4c..72f30d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-16 Jeff Law <law@redhat.com> + + * gcc.dg/tree-ssa/vrp55.c: New test. + 2011-03-16 Jason Merrill <jason@redhat.com> * g++.dg/cpp0x/auto22.C: New. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c new file mode 100644 index 0000000..7adfe62 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-blocks-vops-details" } */ + +fu (char *p, int x) +{ + if (x) + *p = 69; + if (p) + arf (); +} + +/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ + diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 65d249f..d2e6551 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7538,12 +7538,14 @@ identify_jump_threads (void) continue; /* We're basically looking for any kind of conditional with - integral type arguments. */ + integral or pointer type arguments. Note the type of the second + argument will be the same as the first argument, so no need to + check it explicitly. */ if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME - && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))) + && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))) + || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (last)))) && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME - || is_gimple_min_invariant (gimple_cond_rhs (last))) - && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_rhs (last)))) + || is_gimple_min_invariant (gimple_cond_rhs (last)))) { edge_iterator ei; |