summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2009-06-12 19:00:39 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2009-06-12 12:00:39 -0700
commit737142ced7510afcd0144c866d9169ac7cbf3fb6 (patch)
treece8fe06a4a5b43d55c7335eddbcf12d9026c27d4 /gcc/tree-ssa-sccvn.c
parentd3a0d55d663e3837aaba816af1aabf983df0ffab (diff)
downloadgcc-737142ced7510afcd0144c866d9169ac7cbf3fb6.tar.gz
re PR tree-optimization/38865 (missing FRE with VIEW_CONVERT_EXPR)
2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/38865 * tree-ssa-sccvn.c (visit_reference_op_load): If vn_reference_lookup is returns NULL and OP is a VCE, look through the VCE. 2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/38865 * gcc.dg/tree-ssa/fre-vce-1.c : From-SVN: r148437
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 03fea751feb..6d263ded177 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1976,6 +1976,12 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
bool changed = false;
tree result = vn_reference_lookup (op, gimple_vuse (stmt), true, NULL);
+ /* If we have a VCE, try looking up its operand as it might be stored in
+ a different type. */
+ if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR)
+ result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt),
+ true, NULL);
+
/* We handle type-punning through unions by value-numbering based
on offset and size of the access. Be prepared to handle a
type-mismatch here via creating a VIEW_CONVERT_EXPR. */