-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 03/16/11 04:31, Richard Guenther wrote:
On Tue, Mar 15, 2011 at 10:37 PM, Jeff Law l...@redhat.com wrote:
I noticed that VRP was missing many obvious jump threading
opportunities; investigation showed that it wasn't threading through
conditionals with pointer types, just those with integral types.
Fix is rather obvious.
Bootstrapped and regression tested on x86_64-unknown-linux-gnu. OK for
trunk?
Looks ok (a testcase would be nice). Btw, you only need to check
the gimple_cond_lhs, the rhs will have a matching type kind.
Testcase added, simplified condition, updated comments. Bootstrapped
and regression tested on x86_64-unknown-linux-gnu. Installed on trunk.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNgPSRAAoJEBRtltQi2kC75MIH/3SxIa6+sFS7F1fTH9OXE31f
ohdxBKhIKkjRrJTt3aB0mJjmWMf4ajaXlwhESz1aBecUTE29G5xOnC1G2pychzXH
FCPH+cTf2KqDH7sCJf05tCBkKt15FHX/dHYmy8KPSQi01in2g/wa6QYbDJMJGZUl
pbUUOnjTzWxZOr6+ufF/boaKYU5dw65Yc+ABsgiJ/06vUZAJeBisei2xsdhtwuK1
A1lvW3MUyxx5A+h+dX35w4cS1smJYGSXSvtomcqVTjUVU1yKjGhw/tIfbq8sTkVx
UgUvtEbwl+XoDmIoujzuUxayX1SwEMtMULnE4k0HgVMEvN9+jYzoB7Fe2WeUSV0=
=cf+z
-END PGP SIGNATURE-
Index: ChangeLog
===
*** ChangeLog (revision 171047)
--- ChangeLog (working copy)
***
*** 1,3
--- 1,9
+ 2011-03-16 Jeff Law l...@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 rguent...@suse.de
PR tree-optimization/26134
Index: tree-vrp.c
===
*** tree-vrp.c (revision 171007)
--- tree-vrp.c (working copy)
*** identify_jump_threads (void)
*** 7538,7549
continue;
/* We're basically looking for any kind of conditional with
!integral type arguments. */
if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME
! INTEGRAL_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
{
edge_iterator ei;
--- 7538,7551
continue;
/* We're basically looking for any kind of conditional with
!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)))
! || 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
{
edge_iterator ei;
Index: testsuite/gcc.dg/tree-ssa/vrp55.c
===
*** testsuite/gcc.dg/tree-ssa/vrp55.c (revision 0)
--- testsuite/gcc.dg/tree-ssa/vrp55.c (revision 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 } } */
+
Index: testsuite/ChangeLog
===
*** testsuite/ChangeLog (revision 171047)
--- testsuite/ChangeLog (working copy)
***
*** 1,3
--- 1,7
+ 2011-03-16 Jeff Law l...@redhat.com
+
+ * gcc.dg/tree-ssa/vrp55.c: New test.
+
2011-03-16 Richard Guenther rguent...@suse.de
PR testsuite/48147