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
This commit is contained in:
Jeff Law 2011-03-16 11:32:58 -06:00 committed by Jeff Law
parent 23d956f935
commit 6261ab0ee6
4 changed files with 30 additions and 4 deletions

View file

@ -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

View file

@ -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.

View file

@ -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" } } */

View file

@ -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;