aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-06-15 15:37:50 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-06-15 15:37:50 +0000
commit7fc1dad61dd02355750fcb54484f6174c3dbef96 (patch)
tree656bc157f503e875f3dc85e936ccc480715fc49a
parent8a86e760712f136623c1f5ae80a95f827c80014b (diff)
downloadgcc-7fc1dad61dd02355750fcb54484f6174c3dbef96.zip
gcc-7fc1dad61dd02355750fcb54484f6174c3dbef96.tar.gz
gcc-7fc1dad61dd02355750fcb54484f6174c3dbef96.tar.bz2
tree-ssa-pre.c (eliminate): Handle PHI elimination to constants.
2010-06-15 Richard Guenther <rguenther@suse.de> * tree-ssa-pre.c (eliminate): Handle PHI elimination to constants. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Adjust. From-SVN: r160793
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c2
-rw-r--r--gcc/tree-ssa-pre.c9
4 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cbbea6e..960f2fa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-15 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (eliminate): Handle PHI elimination to constants.
+
2010-06-15 Paul Brook <paul@codesourcery.com>
* config/arm/arm.c (use_vfp_abi): Add sorry() for Thumb-1
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 29d0a64..cacbca5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2010-06-15 Richard Guenther <rguenther@suse.de>
+ * gcc.dg/tree-ssa/ssa-sccvn-4.c: Adjust.
+
+2010-06-15 Richard Guenther <rguenther@suse.de>
+
* gcc.dg/vect/bb-slp-21.c: Adjust.
* gcc.dg/vect/bb-slp-13.c: Likewise
* gcc.dg/vect/bb-slp-4.c: Likewise
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
index 27ccda5..fe41966 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
@@ -23,5 +23,5 @@ int vnum_test8(int *data)
}
/* We should eliminate m - n, n + k, set data[5] = 0, eliminate the
address arithmetic for data[5], and set p = 0.
-/* { dg-final { scan-tree-dump-times "Eliminated: 6" 1 "fre"} } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 7" 1 "fre"} } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 687a363..a62439f 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4330,7 +4330,14 @@ eliminate (void)
else
gcc_unreachable ();
}
- if (!sprimeexpr
+ if (!sprime && is_gimple_min_invariant (VN_INFO (res)->valnum))
+ {
+ sprime = VN_INFO (res)->valnum;
+ if (!useless_type_conversion_p (TREE_TYPE (res),
+ TREE_TYPE (sprime)))
+ sprime = fold_convert (TREE_TYPE (res), sprime);
+ }
+ if (!sprime
|| sprime == res)
{
gsi_next (&gsi);