+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 Ian Lance Taylor <iant@google.com>
PR bootstrap/40430
--- /dev/null
+/* { dg-options "-O2 -fdump-tree-fre -w" } */
+/* { dg-do compile } */
+#define vector __attribute__((vector_size(sizeof(int)*4) ))
+struct s { vector int i; };
+vector float f(struct s *sv)
+{
+ sv->i = (vector int){1, 2, 3, 4};
+ return (vector float)sv->i;
+}
+
+
+vector float f1(struct s *sv, vector int a)
+{
+ sv->i = a;
+ return (vector float)sv->i;
+}
+
+struct s1 { int i; };
+
+void g(struct s1 *, float);
+void a1 (struct s1 sv)
+{
+ sv.i = 1;
+ g(&sv, *(float*)&sv.i);
+}
+
+
+void a2 (struct s1 sv, int i)
+{
+ sv.i = i;
+ g(&sv, *(float*)&sv.i);
+}
+
+/* { dg-final { scan-tree-dump-times "sv_\[0-9\]\\\(D\\\)->i" 2 "fre" } } */
+/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" } } */
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. */