aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
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 /gcc/tree-ssa-pre.c
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
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c9
1 files changed, 8 insertions, 1 deletions
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);