Patchwork mem-ref2 merge, testsuite parts

login
register
mail settings
Submitter Richard Guenther
Date June 28, 2010, 9:20 a.m.
Message ID <alpine.LNX.2.00.1006281119220.1429@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/57120/
State New
Headers show

Comments

Richard Guenther - June 28, 2010, 9:20 a.m.
Mainly new testcases and dump file scan adjustments.  And the bulk
that comes with disabling struct-reorg.

Richard.

	* gcc.c-torture/execute/20100316-1.c: New testcase.
	* gcc.c-torture/execute/pr44468.c: Likewise.
	* gcc.c-torture/compile/20100609-1.c: Likewise.
	* gcc.dg/volatile2.c: Adjust.
	* gcc.dg/plugin/selfassign.c: Likewise.
	* gcc.dg/pr36902.c: Likewise.
	* gcc.dg/tree-ssa/foldaddr-2.c: Remove.
	* gcc.dg/tree-ssa/foldaddr-3.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-8.c: Adjust.
	* gcc.dg/tree-ssa/pr17141-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-13.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-14.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise.
	* gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise.
	* gcc.dg/tree-ssa/20030807-7.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-10.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
	* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-1.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-2.c: Likewise.
	* gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise.
	* gcc.dg/tree-ssa/ssa-pre-26.c: Likewise.
	* gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise.
	* gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise.
	* gcc.dg/tree-ssa/ssa-pre-7.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-5.c: Likewise.
	* gcc.dg/struct/w_prof_two_strs.c: XFAIL.
	* gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise.
	* gcc.dg/struct/wo_prof_global_var.c: Likewise.
	* gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise.
	* gcc.dg/struct/w_prof_local_array.c: Likewise.
	* gcc.dg/struct/w_prof_single_str_global.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_str_init.c: Likewise.
	* gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise.
	* gcc.dg/struct/w_prof_global_array.c: Likewise.
	* gcc.dg/struct/wo_prof_array_field.c: Likewise.
	* gcc.dg/struct/wo_prof_single_str_local.c: Likewise.
	* gcc.dg/struct/w_prof_local_var.c: Likewise.
	* gcc.dg/struct/wo_prof_two_strs.c: Likewise.
	* gcc.dg/struct/wo_prof_empty_str.c: Likewise.
	* gcc.dg/struct/wo_prof_local_array.c: Likewise.
	* gcc.dg/struct/w_prof_global_var.c: Likewise.
	* gcc.dg/struct/wo_prof_single_str_global.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise.
	* gcc.dg/struct/wo_prof_global_array.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_return.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise.
	* gcc.dg/struct/wo_prof_double_malloc.c: Likewise.
	* gcc.dg/struct/w_ratio_cold_str.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise.
	* gcc.dg/struct/wo_prof_local_var.c: Likewise.
	* gcc.dg/tree-prof/stringop-1.c: Adjust.
	* g++.dg/tree-ssa/pr31146.C: Likewise.
	* g++.dg/tree-ssa/copyprop-1.C: Likewise.
	* g++.dg/tree-ssa/pr33604.C: Likewise.
	* g++.dg/plugin/selfassign.c: Likewise.
	* gfortran.dg/array_memcpy_3.f90: Likewise.
	* gfortran.dg/array_memcpy_4.f90: Likewise.
	* c-c++-common/torture/pr42834.c: New testcase.

Patch

Index: gcc/testsuite/gcc.c-torture/execute/20100316-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/20100316-1.c	(.../trunk)	(revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/20100316-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -0,0 +1,24 @@ 
+struct Foo {
+  int i;
+  unsigned precision : 10;
+  unsigned blah : 3;
+} f;
+
+int __attribute__((noinline,noclone))
+foo (struct Foo *p)
+{
+  struct Foo *q = p;
+  return (*q).precision;
+}
+
+extern void abort (void);
+
+int main()
+{
+  f.i = -1;
+  f.precision = 0;
+  f.blah = -1;
+  if (foo (&f) != 0)
+    abort ();
+  return 0;
+}
Index: gcc/testsuite/gcc.c-torture/execute/pr44468.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr44468.c	(.../trunk)	(revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/pr44468.c	(.../branches/mem-ref2)	(revision 161369)
@@ -0,0 +1,60 @@ 
+#include <stddef.h>
+
+struct S {
+  int i;
+  int j;
+};
+struct R {
+  int k;
+  struct S a;
+};
+struct Q {
+  float k;
+  struct S a;
+};
+struct Q s;
+int __attribute__((noinline,noclone))
+test1 (void *q)
+{
+  struct S *b = (struct S *)((char *)q + sizeof (int));
+  s.a.i = 0;
+  b->i = 3;
+  return s.a.i;
+}
+int __attribute__((noinline,noclone))
+test2 (void *q)
+{
+  struct S *b = &((struct R *)q)->a;
+  s.a.i = 0;
+  b->i = 3;
+  return s.a.i;
+}
+int __attribute__((noinline,noclone))
+test3 (void *q)
+{
+  s.a.i = 0;
+  ((struct S *)((char *)q + sizeof (int)))->i = 3;
+  return s.a.i;
+}
+extern void abort (void);
+int
+main()
+{
+  if (sizeof (float) != sizeof (int)
+      || offsetof (struct R, a) != sizeof (int)
+      || offsetof (struct Q, a) != sizeof (int))
+    return 0;
+  s.a.i = 1;
+  s.a.j = 2;
+  if (test1 ((void *)&s) != 3)
+    abort ();
+  s.a.i = 1;
+  s.a.j = 2;
+  if (test2 ((void *)&s) != 3)
+    abort ();
+  s.a.i = 1;
+  s.a.j = 2;
+  if (test3 ((void *)&s) != 3)
+    abort ();
+  return 0;
+}
Index: gcc/testsuite/gcc.c-torture/compile/20100609-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20100609-1.c	(.../trunk)	(revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/20100609-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -0,0 +1,8 @@ 
+extern unsigned long int strtoul (__const char *__restrict __nptr,       char **__restrict __endptr, int __base);
+int find_reloads (int i, char *p)
+{
+  int c;
+  while ((c = *p++))
+    return strtoul (p - 1, &p, 10); 
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/volatile2.c
===================================================================
--- gcc/testsuite/gcc.dg/volatile2.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/volatile2.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-gimple -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
 
 struct GTeth_desc
 {
@@ -12,14 +12,11 @@  struct GTeth_softc
 
 void foo(struct GTeth_softc *sc)
 {
-  /* Verify that we retain the cast to (volatile struct GTeth_desc *)
-     after gimplification and that we keep the volatileness on the
+  /* Verify that we retain the volatileness on the
      store until after optimization.  */
   volatile struct GTeth_desc *p = &sc->txq_desc[0];
   p->ed_cmdsts = 0;
 }
 
-/* { dg-final { scan-tree-dump "\\(volatile struct GTeth_desc \\*\\) D" "gimple" } } */
 /* { dg-final { scan-tree-dump "{v}" "optimized" } } */
-/* { dg-final { cleanup-tree-dump "gimple" } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/plugin/selfassign.c
===================================================================
--- gcc/testsuite/gcc.dg/plugin/selfassign.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/plugin/selfassign.c	(.../branches/mem-ref2)	(revision 161369)
@@ -52,9 +52,7 @@  get_real_ref_rhs (tree expr)
               /* We are only interested in an assignment with a single
                  rhs operand because if it is not, the original assignment
                  will not possibly be a self-assignment.  */
-              if (is_gimple_assign (def_stmt)
-                  && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
-                      == GIMPLE_SINGLE_RHS))
+              if (gimple_assign_single_p (def_stmt))
                 return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
               else
                 return NULL_TREE;
@@ -66,7 +64,7 @@  get_real_ref_rhs (tree expr)
       case PARM_DECL:
       case FIELD_DECL:
       case COMPONENT_REF:
-      case INDIRECT_REF:
+      case MEM_REF:
       case ARRAY_REF:
         return expr;
       default:
@@ -116,17 +114,18 @@  get_non_ssa_expr (tree expr)
           else
             return expr;
         }
-      case INDIRECT_REF:
+      case MEM_REF:
         {
           tree orig_base = TREE_OPERAND (expr, 0);
-          tree base = get_non_ssa_expr (orig_base);
-          if (!base)
-            return NULL_TREE;
-          /* If BASE is converted, build a new indirect reference tree.  */
-          if (base != orig_base)
-            return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
-          else
-            return expr;
+	  if (TREE_CODE (orig_base) == SSA_NAME)
+	    {
+	      tree base = get_non_ssa_expr (orig_base);
+	      if (!base)
+		return NULL_TREE;
+	      return fold_build2 (MEM_REF, TREE_TYPE (expr),
+				  base, TREE_OPERAND (expr, 1));
+	    }
+	  return expr;
         }
       case ARRAY_REF:
         {
@@ -153,9 +152,7 @@  get_non_ssa_expr (tree expr)
               && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
             {
               gimple def_stmt = SSA_NAME_DEF_STMT (expr);
-              if (is_gimple_assign (def_stmt)
-                  && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
-                      == GIMPLE_SINGLE_RHS))
+              if (gimple_assign_single_p (def_stmt))
                 vdecl = gimple_assign_rhs1 (def_stmt);
             }
           return get_non_ssa_expr (vdecl);
@@ -201,9 +198,7 @@  warn_self_assign (gimple stmt)
   tree rhs, lhs;
 
   /* Check assigment statement.  */
-  if (is_gimple_assign (stmt)
-      && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
-          == GIMPLE_SINGLE_RHS))
+  if (gimple_assign_single_p (stmt))
     {
       rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
       if (!rhs)
Index: gcc/testsuite/gcc.dg/pr36902.c
===================================================================
--- gcc/testsuite/gcc.dg/pr36902.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/pr36902.c	(.../branches/mem-ref2)	(revision 161369)
@@ -44,7 +44,7 @@  foo2(unsigned char * to, const unsigned
       *to = *from;
       break;
     case 5:
-      to[4] = from [4]; /* { dg-warning "20:array subscript is above array bounds" } */
+      to[4] = from [4]; /* { dg-warning "array subscript is above array bounds" } */
       break;
     }
   return to;
Index: gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,13 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-struct a{
-	int a;
-	int b;
-} a;
-int *
-t()
-{
-	return (int *)&a;
-}
-/* { dg-final { scan-tree-dump "a.a" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,28 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-union a
-{
-  struct s1
-  {
-    long long a;
-    long long b;
-  } s1;
-  struct s2
-  {
-    int c;
-    int d;
-  } s2;
-  struct s3
-  {
-    unsigned long long e;
-    unsigned long long f;
-  } s3;
-} a;
-int *
-t ()
-{
-  return (int *) &a;
-}
-
-/* { dg-final { scan-tree-dump "a.s2.c" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c	(.../branches/mem-ref2)	(revision 161369)
@@ -12,5 +12,5 @@  int foo(struct X *q)
 
 /* We should have propragated &q->a into (*pointer).  */
 /* { dg-final { scan-tree-dump-times "pointer" 0 "forwprop1"} } */
-/* { dg-final { scan-tree-dump "->a\\\[0\\\]" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "\\\[0\\\]" "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-forwprop1" } */
 
 struct A { int i; };
 int
@@ -11,5 +11,7 @@  foo(struct A *locp, int str)
   return locp->i;
 }
 
-/* { dg-final { scan-tree-dump "locp.*->i =" "forwprop1" } } */
+/* We should have propagated &locp->i into its dereference.  */
+
+/* { dg-final { scan-tree-dump "locp_\[^\\n\]* =" "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c	(.../branches/mem-ref2)	(revision 161369)
@@ -23,6 +23,5 @@  void foo(double (*q)[4], struct Foo *tmp
     }
 }
 
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data with &a" "fre" } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c	(.../branches/mem-ref2)	(revision 161369)
@@ -27,6 +27,5 @@  void foo(double (*q)[4])
   bar(a);
 }
 
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1.data with &a" "fre" } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c	(.../branches/mem-ref2)	(revision 161369)
@@ -21,5 +21,9 @@  int bar (void)
   return q->i;
 }
 
-/* { dg-final { scan-tree-dump-times "a.b.i" 2 "ccp1" } } */
+/* The first access is through struct A, so a.b.i is fine,
+   the second access needs to preserve the original access type struct B.  */
+
+/* { dg-final { scan-tree-dump-times "a.b.i" 1 "ccp1" } } */
+/* { dg-final { scan-tree-dump-times "MEM\\\[\\\(struct B \\\*\\\)&a\\\].i" 1 "ccp1" } } */
 /* { dg-final { cleanup-tree-dump "ccp1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
 
 extern void abort (void);
 struct X {
@@ -22,5 +22,5 @@  foo(int i, int j, int k, int off)
   return *q;
 }
 
-/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c	(.../branches/mem-ref2)	(revision 161369)
@@ -33,5 +33,5 @@  simplify_condition (cond_p)
 }
 
 /* There should be exactly one IF conditional.  */
-/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" { xfail *-*-* } } } */
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
 
 int b;
 unsigned a;
@@ -15,9 +15,8 @@  void test2(void)
 }
 
 /* The indirect load should be replaced by a load from a and a
-   conversion to int.  */
+   conversion to int.  FRE should then be able to replace
+   the rhs of the store to b by 1.  */
 
-/* { dg-final { scan-tree-dump "= a;" "forwprop1" } } */
-/* { dg-final { scan-tree-dump "= \\\(int\\\) " "forwprop1" } } */
-/* { dg-final { scan-tree-dump-not "= \\\*" "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\\n\]*with 1" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -11,6 +11,5 @@  int f(int *a)
   return *c + t;
 }
 
-/* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced \\\*a_\[^\n\].*with t_" "fre" } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
 
 extern void abort (void);
 struct X {
@@ -22,5 +22,5 @@  foo(int i, int j, int k, int off)
   return *q;
 }
 
-/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c	(.../branches/mem-ref2)	(revision 161369)
@@ -15,5 +15,5 @@  int foo (void)
   return *x;
 }
 
-/* { dg-final { scan-tree-dump "a.i\\\[1\\\]" "ccp1" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[\\\(int \\\*\\\)&a \\\+ 4B\\\]" "ccp1" } } */
 /* { dg-final { cleanup-tree-dump "ccp1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -15,5 +15,5 @@  void f(struct a * b, __SIZE_TYPE__ i)
   c[i] = 1;
 }
 
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c	(.../branches/mem-ref2)	(revision 161369)
@@ -17,5 +17,5 @@  void f(__SIZE_TYPE__ i)
   c[i] = 1;
 }
 
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop?" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do "compile" } */
-/* { dg-options "-O2 -fdump-tree-fre" } */
+/* { dg-options "-O2 -fdump-tree-fre-details" } */
 
 struct S { float f; };
 int __attribute__((noinline))
@@ -11,5 +11,5 @@  foo (float *r, struct S *p)
   return i + *q;
 }
 
-/* { dg-final { scan-tree-dump-times "\\\*q" 1 "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\n\]*with i_." "fre" } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c	(.../branches/mem-ref2)	(revision 161369)
@@ -9,6 +9,6 @@  int foo(int i)
 }
 
 /* { dg-final { scan-tree-dump "&a\\\[\[iD\]\\\." "ccp1" } } */
-/* { dg-final { scan-tree-dump "= a\\\[\[iD\]\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "= .*&a\\\]\\\[\[iD\]\\\." "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "ccp1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-Os -fdump-tree-pre-details" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
 
 typedef union
 {
@@ -23,5 +23,5 @@  void foo(SA* pResult, SB* method, SC* se
     pResult->data = pResult->data;
 }
 
-/* { dg-final { scan-tree-dump "Deleted redundant store" "pre" } } */
-/* { dg-final { cleanup-tree-dump "pre" } } */
+/* { dg-final { scan-tree-dump "Deleted redundant store" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c	(.../branches/mem-ref2)	(revision 161369)
@@ -12,7 +12,8 @@  foo ( struct S *p)
 }
 
 
-/*  There should only be one load of p->f because fwprop can change *(int *)&p->f into just (int)p->f.  */
-/* { dg-final { scan-tree-dump-times "p_.\\\(D\\\)->f" 1 "fre" } } */
+/* There should only be one load of p->f because fwprop can change
+   *(int *)&p->f into just (int)p->f.  */
+/* { dg-final { scan-tree-dump-times "= \[^\n\]*p_.\\\(D\\\)" 1 "fre" } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
 
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c	(.../branches/mem-ref2)	(revision 161369)
@@ -7,5 +7,5 @@  int foo(int i)
   return (a + 1)[i];
 }
 
-/* { dg-final { scan-tree-dump "= a\\\[D\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "=.*&a\\\]\\\[D\\\." "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c	(.../branches/mem-ref2)	(revision 161369)
@@ -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: 7" 1 "fre"} } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 5" 1 "fre"} } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c	(.../branches/mem-ref2)	(revision 161369)
@@ -7,6 +7,6 @@  foo (int *array)
           return array[1];
       return 0;
 }
-/* We should eliminate one address calculation, and one load.  */
-/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */
+/* We should eliminate one load.  */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "fre"} } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-forwprop1 -w" } */
+/* { dg-options "-O1 -fdump-tree-esra -w" } */
 
 #define vector __attribute__((vector_size(16) ))
 struct VecClass
@@ -15,7 +15,8 @@  vector float foo( vector float v )
     return y.v;
 }
 
-/* We should be able to convert the cast to a VCE in forwprop1. */
-/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "forwprop1"} } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
-
+/* We should be able to remove the intermediate struct and directly
+   return x.  As we do not fold VIEW_CONVERT_EXPR<struct VecClass>(x).v
+   that doesn't happen right now.  */
+/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_two_strs.c	(.../branches/mem-ref2)	(revision 161369)
@@ -61,6 +61,6 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
 
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_arg_to_local.c	(.../branches/mem-ref2)	(revision 161369)
@@ -42,5 +42,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is passed to local function...Excluded." "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is passed to local function...Excluded." "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_global_var.c	(.../branches/mem-ref2)	(revision 161369)
@@ -42,5 +42,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c	(.../branches/mem-ref2)	(revision 161369)
@@ -44,5 +44,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_local_array.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_local_array.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_local_array.c	(.../branches/mem-ref2)	(revision 161369)
@@ -34,5 +34,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_single_str_global.c	(.../branches/mem-ref2)	(revision 161369)
@@ -28,6 +28,6 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
 
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_str_init.c	(.../branches/mem-ref2)	(revision 161369)
@@ -28,6 +28,6 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is initialized...Excluded" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is initialized...Excluded" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
 
Index: gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_array_through_pointer.c	(.../branches/mem-ref2)	(revision 161369)
@@ -35,5 +35,5 @@  main ()
   return 0;
 }
 
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_global_array.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_global_array.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_global_array.c	(.../branches/mem-ref2)	(revision 161369)
@@ -26,5 +26,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_array_field.c	(.../branches/mem-ref2)	(revision 161369)
@@ -23,5 +23,5 @@  int main()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_single_str_local.c	(.../branches/mem-ref2)	(revision 161369)
@@ -31,5 +31,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_local_var.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_local_var.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_local_var.c	(.../branches/mem-ref2)	(revision 161369)
@@ -37,5 +37,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_two_strs.c	(.../branches/mem-ref2)	(revision 161369)
@@ -64,5 +64,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_empty_str.c	(.../branches/mem-ref2)	(revision 161369)
@@ -43,5 +43,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_local_array.c	(.../branches/mem-ref2)	(revision 161369)
@@ -37,5 +37,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_prof_global_var.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_prof_global_var.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_prof_global_var.c	(.../branches/mem-ref2)	(revision 161369)
@@ -39,5 +39,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_single_str_global.c	(.../branches/mem-ref2)	(revision 161369)
@@ -31,5 +31,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_value.c	(.../branches/mem-ref2)	(revision 161369)
@@ -42,5 +42,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_global_array.c	(.../branches/mem-ref2)	(revision 161369)
@@ -29,5 +29,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_return.c	(.../branches/mem-ref2)	(revision 161369)
@@ -29,5 +29,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is return type of function...Excluded" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is return type of function...Excluded" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_array.c	(.../branches/mem-ref2)	(revision 161369)
@@ -30,5 +30,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_double_malloc.c	(.../branches/mem-ref2)	(revision 161369)
@@ -26,5 +26,5 @@  int main()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/w_ratio_cold_str.c	(.../branches/mem-ref2)	(revision 161369)
@@ -39,5 +39,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */
+/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final-use { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c	(.../branches/mem-ref2)	(revision 161369)
@@ -45,5 +45,5 @@  main (void)
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" } } */
+/* { dg-final { scan-ipa-dump "is a field in the structure" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c
===================================================================
--- gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/struct/wo_prof_local_var.c	(.../branches/mem-ref2)	(revision 161369)
@@ -40,5 +40,5 @@  main ()
 }
 
 /*--------------------------------------------------------------------------*/
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail *-*-* } } } */
 /* { dg-final { cleanup-ipa-dump "*" } } */
Index: gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-prof/stringop-1.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gcc.dg/tree-prof/stringop-1.c	(.../branches/mem-ref2)	(revision 161369)
@@ -16,7 +16,7 @@  main()
 /* { dg-final-use { scan-tree-dump "Single value 4 stringop" "tree_profile"} } */
 /* Really this ought to simplify into assignment, but we are not there yet.  */
 /* a[0] = b[0] is what we fold the resulting memcpy into.  */
-/* { dg-final-use { scan-tree-dump "a.0. = " "optimized"} } */
-/* { dg-final-use { scan-tree-dump "= b.0." "optimized"} } */
+/* { dg-final-use { scan-tree-dump " = MEM.*&b" "optimized"} } */
+/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */
 /* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
Index: gcc/testsuite/g++.dg/tree-ssa/pr31146.C
===================================================================
--- gcc/testsuite/g++.dg/tree-ssa/pr31146.C	(.../trunk)	(revision 161367)
+++ gcc/testsuite/g++.dg/tree-ssa/pr31146.C	(.../branches/mem-ref2)	(revision 161369)
@@ -12,5 +12,5 @@  void foo (int j)
   *q = 1;
 }
 
-/* { dg-final { scan-tree-dump "i\\\[j.*\\\] =.* 1;" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[.*&i\\\]\\\[j.*\\\] =.* 1;" "forwprop1" } } */
 /* { dg-final { cleanup-tree-dump "forwprop?" } } */
Index: gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C
===================================================================
--- gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C	(.../trunk)	(revision 161367)
+++ gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C	(.../branches/mem-ref2)	(revision 161369)
@@ -25,5 +25,7 @@  int foo(Object&o)
   return o[0];
 }
 
-/* { dg-final { scan-tree-dump-not ".* = \[^>;\]*;" "dce2" } } */
+/* Remaining should be two loads.  */
+
+/* { dg-final { scan-tree-dump-times " = \[^\n\]*;" 2 "dce2" } } */
 /* { dg-final { cleanup-tree-dump "dce2" } } */
Index: gcc/testsuite/g++.dg/tree-ssa/pr33604.C
===================================================================
--- gcc/testsuite/g++.dg/tree-ssa/pr33604.C	(.../trunk)	(revision 161367)
+++ gcc/testsuite/g++.dg/tree-ssa/pr33604.C	(.../branches/mem-ref2)	(revision 161369)
@@ -1,5 +1,5 @@ 
 /* { dg-do run } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-optimized-vops" } */
 
 struct Value
 {
@@ -35,12 +35,14 @@  int main(int argc, char *argv[])
   return 0;
 }
 
-/* Check that we forward propagated
+/* Check that we propagate
      D.2182_13 = (struct Ref *) &D.2137.lhs;
    to
      D.2182_13->lhs.m ={v} &I;
    yielding
-     D.2137.lhs.m ={v} &I;  */
+     D.2137.lhs.m ={v} &I;
+   so that SRA can promote all locals to registers and we end up
+   referencing a single virtual operand at abort () after optimization.  */
 
-/* { dg-final { scan-tree-dump-times "D\\\.....\\\..hs\\\.m =" 2 "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times ".MEM_\[0-9\]*\\\(D\\\)" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/g++.dg/plugin/selfassign.c
===================================================================
--- gcc/testsuite/g++.dg/plugin/selfassign.c	(.../trunk)	(revision 161367)
+++ gcc/testsuite/g++.dg/plugin/selfassign.c	(.../branches/mem-ref2)	(revision 161369)
@@ -52,9 +52,7 @@  get_real_ref_rhs (tree expr)
               /* We are only interested in an assignment with a single
                  rhs operand because if it is not, the original assignment
                  will not possibly be a self-assignment.  */
-              if (is_gimple_assign (def_stmt)
-                  && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
-                      == GIMPLE_SINGLE_RHS))
+              if (gimple_assign_single_p (def_stmt))
                 return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
               else
                 return NULL_TREE;
@@ -66,7 +64,7 @@  get_real_ref_rhs (tree expr)
       case PARM_DECL:
       case FIELD_DECL:
       case COMPONENT_REF:
-      case INDIRECT_REF:
+      case MEM_REF:
       case ARRAY_REF:
         return expr;
       default:
@@ -116,17 +114,18 @@  get_non_ssa_expr (tree expr)
           else
             return expr;
         }
-      case INDIRECT_REF:
+      case MEM_REF:
         {
           tree orig_base = TREE_OPERAND (expr, 0);
-          tree base = get_non_ssa_expr (orig_base);
-          if (!base)
-            return NULL_TREE;
-          /* If BASE is converted, build a new indirect reference tree.  */
-          if (base != orig_base)
-            return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
-          else
-            return expr;
+	  if (TREE_CODE (orig_base) == SSA_NAME)
+	    {
+	      tree base = get_non_ssa_expr (orig_base);
+	      if (!base)
+		return NULL_TREE;
+	      return fold_build2 (MEM_REF, TREE_TYPE (expr),
+				  base, TREE_OPERAND (expr, 1));
+	    }
+	  return expr;
         }
       case ARRAY_REF:
         {
@@ -153,9 +152,7 @@  get_non_ssa_expr (tree expr)
               && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
             {
               gimple def_stmt = SSA_NAME_DEF_STMT (expr);
-              if (is_gimple_assign (def_stmt)
-                  && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
-                      == GIMPLE_SINGLE_RHS))
+              if (gimple_assign_single_p (def_stmt))
                 vdecl = gimple_assign_rhs1 (def_stmt);
             }
           return get_non_ssa_expr (vdecl);
@@ -201,9 +198,7 @@  warn_self_assign (gimple stmt)
   tree rhs, lhs;
 
   /* Check assigment statement.  */
-  if (is_gimple_assign (stmt)
-      && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
-          == GIMPLE_SINGLE_RHS))
+  if (gimple_assign_single_p (stmt))
     {
       rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
       if (!rhs)

Index: gcc/testsuite/gfortran.dg/array_memcpy_3.f90
===================================================================
--- gcc/testsuite/gfortran.dg/array_memcpy_3.f90	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gfortran.dg/array_memcpy_3.f90	(.../branches/mem-ref2)	(revision 161369)
@@ -11,5 +11,5 @@  subroutine bar(x)
   x = (/ 3, 1, 4, 1 /)
 end subroutine
 
-! { dg-final { scan-tree-dump-times "memcpy|ref-all" 2 "original" } }
+! { dg-final { scan-tree-dump-times "memcpy|(ref-all.*ref-all)" 2 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
Index: gcc/testsuite/gfortran.dg/array_memcpy_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/array_memcpy_4.f90	(.../trunk)	(revision 161367)
+++ gcc/testsuite/gfortran.dg/array_memcpy_4.f90	(.../branches/mem-ref2)	(revision 161369)
@@ -9,5 +9,5 @@ 
 
   d = s
 end
-! { dg-final { scan-tree-dump-times "d = " 1 "original" } }
+! { dg-final { scan-tree-dump-times "MEM.*d\\\] = MEM" 1 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }

Index: gcc/testsuite/c-c++-common/torture/pr42834.c
===================================================================
--- gcc/testsuite/c-c++-common/torture/pr42834.c	(.../trunk)	(revision 0)
+++ gcc/testsuite/c-c++-common/torture/pr42834.c	(.../branches/mem-ref2)	(revision 161369)
@@ -0,0 +1,23 @@ 
+/* { dg-do run } */
+
+void __attribute__((noinline,noclone))
+foo(int *p, float *q) { __asm__ volatile ("" : : : "memory"); }
+
+int main()
+{
+  if (sizeof (int) == sizeof (float))
+    {
+      int i;
+      float f;
+      int *p;
+      /* Prevent i and f from being rewritten into SSA form.  */
+      foo (&i, &f);
+      i = 0;
+      f = 1.0;
+      p = (int *)&f;
+      __builtin_memcpy (&i, p, 4);
+      if (*(float *)&i != 1.0)
+	__builtin_abort ();
+    }
+  return 0;
+}