This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/3] Testcase changes for the new SRA


The following patch amends testcases (rather than the compiler) so
that they not fail with the new intra-SRA.

The FRE testcases rely on the fact that SRA does not scalarize unions.
The new one,  however, does.  Therefore I simply  switched SRA off for
them (and Richi approved this change anlready).

The gfortran.dg/pr25923.f90 expects a weird warning that I do not give
out because the new SRA does not scalarize anything in that particular
testcase  because the  individual fields  of the  structure  are never
accessed on their  own.  I have XFAILed the  warning test as requested
(http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02237.html).

A few testcases used the removed parameters so I made them not to.

I have added a few testcases of my own, mainly to test that unions get
scalarized  too but  also  that "subaccesses"  are propagated  accross
assignments.

With this patch, there are  no regressions (not counting the xfail) in
the testsuite on  x86_64-linux-gnu (inluding Ada) and i586-suse-linux.
The  patch has  bootstrapped  on hppa-linux-gnu  but  tests are  still
running.

Thanks,

Martin


2009-05-26  Martin Jambor  <mjambor@suse.cz>

	    * gfortran.dg/pr25923.f90: XFAIL warning expectation.
	    * gcc.dg/tree-ssa/ssa-fre-7.c: Compile with -fno-tree-sra.
	    * gcc.dg/tree-ssa/ssa-fre-8.c: Likewise.
	    * gcc.dg/tree-ssa/ssa-fre-9.c: Likewise.
	    * gcc.dg/memcpy-1.c: Removed param sra-max-structure-size.
	    * gcc.dg/tree-ssa/sra-2.c: Likewise.
	    * gcc.dg/tree-ssa/sra-3.c: Likewise.
	    * gcc.dg/tree-ssa/sra-1.c: Likewise and added union tests.
	    * gcc.dg/tree-ssa/sra-4.c: Changed comment.
	    * gcc.dg/tree-ssa/sra-5.c: New file.
	    * gcc.dg/tree-ssa/sra-6.c: New file.


Index: mine/gcc/testsuite/gfortran.dg/pr25923.f90
===================================================================
--- mine.orig/gcc/testsuite/gfortran.dg/pr25923.f90
+++ mine/gcc/testsuite/gfortran.dg/pr25923.f90
@@ -10,7 +10,7 @@ implicit none
 
 contains
 
-  function baz(arg) result(res) ! { dg-warning "res.yr' may be" }
+  function baz(arg) result(res) ! { dg-warning "res.yr' may be" "" { xfail *-*-* } }
     type(bar), intent(in) :: arg
     type(bar) :: res
     logical, external:: some_func
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-fre-details -fdump-tree-optimized" } */
+/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details -fdump-tree-optimized" } */
 #if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
 typedef int intflt;
 #elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-fre-details" } */
+/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */
 #if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
 typedef int intflt;
 #elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-fre-stats" } */
+/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-stats" } */
 
 union loc {
     unsigned reg;
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-1.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/sra-1.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
 
 /* Tests for SRA. */
 
@@ -68,6 +68,73 @@ copystruct111111 (teststruct param)
     link_error ();
 }
 
+
+typedef union testunion
+{
+  double d;
+  char f1;
+} testunion;
+
+void
+copyunion1 (testunion param)
+{
+  testunion local;
+  param.f1 = 0;
+  local = param;
+  if (local.f1 != 0)
+    link_error ();
+}
+
+void
+copyunion11 (testunion *param)
+{
+  testunion local;
+  param->f1 = 0;
+  local = *param;
+  if (local.f1 != 0)
+    link_error ();
+}
+
+void
+copyunion111 (testunion param)
+{
+  testunion *local = &param;
+  param.f1 = 0;
+  if (local->f1 != 0)
+    link_error ();
+}
+
+testunion globuf;
+void
+copyunion1111 (void)
+{
+  testunion local;
+  globuf.f1 = 0;
+  local = globuf;
+  if (local.f1 != 0)
+    link_error ();
+}
+
+void
+copyunion11111 (void)
+{
+  testunion *local = &globuf;
+  globuf.f1 = 0;
+  if (local->f1 != 0)
+    link_error ();
+}
+
+void
+copyunion111111 (testunion param)
+{
+  static testunion local;
+  param.f1 = 0;
+  local = param;
+  if (local.f1 != 0)
+    link_error ();
+}
+
+
 /* There should be no referenc to link_error. */
 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c
@@ -1,5 +1,5 @@
-/* { dg-do compile } */ 
-/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
 
 /* Test for SRA. */
 
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-optimized -w" } */
-/* Check that SRA does non block copies for structs that just contain vectors. */
+/* Check that SRA replaces strucutres containing vectors. */
 
 #define vector __attribute__((vector_size(16)))
 
@@ -20,7 +20,5 @@ vector int f(vector int t1, vector int t
   return st3.t;
 }
 
-/* There should be no references to st as SRA should not have done block copy. */
 /* { dg-final { scan-tree-dump-times "st" 0 "optimized" } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
-
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-5.c
===================================================================
--- /dev/null
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-5.c
@@ -0,0 +1,75 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* Let gimple verifier check what SRA does to unions and single-field
+   strucutres . */
+
+struct sim_struct
+{
+  int x;
+};
+
+extern struct sim_struct get_x(void);
+
+struct sim_struct foo (void)
+{
+  struct sim_struct simple;
+
+  simple = get_x ();
+  if (simple.x % 2)
+    simple.x = 39;
+  else
+    simple.x -=8;
+
+  return simple;
+}
+
+struct sim_cmplx
+{
+  _Complex double c;
+};
+
+extern struct sim_cmplx get_sc (void);
+
+_Complex double foo_c (void)
+{
+  struct sim_cmplx simple;
+
+  simple = get_sc ();
+  if (__real__ simple.c > 200.3)
+    __imag__ simple.c -= 2.4;
+
+  return simple.c;
+}
+
+
+union sim_union
+{
+  int i;
+  float d;
+};
+
+extern union sim_union get_y (void);
+
+union sim_union bar (void)
+{
+  union sim_union simple;
+
+  simple = get_y ();
+  if (simple.d > 8.2)
+    simple.i = 300;
+
+  return simple;
+}
+
+extern int get_int (void);
+
+int bar_i (void)
+{
+  union sim_union simple;
+
+  simple = get_y ();
+  if (simple.d > 8.2)
+    simple.i = get_int ();
+
+  return simple.i;
+}
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-6.c
===================================================================
--- /dev/null
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-6.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-esra-details" } */
+
+typedef struct teststruct
+{
+  double d;
+  int i1;
+  char c1;
+  float z;
+  char c2;
+  int i2;
+} teststruct;
+
+
+void cow (int i)
+{
+  teststruct a, b, c, d;
+
+  a.d = 3.2;
+  a.i1 = i;
+
+  b = a;
+  c = b;
+  d = c;
+
+  if (d.i1 != i)
+    link_error ();
+}
+
+
+/* Suaccesses of b and c should have been created.  */
+/* { dg-final { scan-tree-dump "expr = b.d"  "esra"} } */
+/* { dg-final { scan-tree-dump "expr = b.i1"  "esra"} } */
+/* { dg-final { scan-tree-dump "expr = c.d"  "esra"} } */
+/* { dg-final { scan-tree-dump "expr = c.i1"  "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
+
+/* There should be no referenc to link_error.  */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: mine/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c
+++ mine/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
 
 /* Test for SRA. */
 
Index: mine/gcc/testsuite/gcc.dg/memcpy-1.c
===================================================================
--- mine.orig/gcc/testsuite/gcc.dg/memcpy-1.c
+++ mine/gcc/testsuite/gcc.dg/memcpy-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized --param sra-max-structure-size=32" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
 /* PR36598 AVR fail maybe due to cost metrics */
 /* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" { xfail { "avr-*-*" } } } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: mine/gcc/testsuite/gnat.dg/pack9.adb
===================================================================
--- mine.orig/gcc/testsuite/gnat.dg/pack9.adb
+++ mine/gcc/testsuite/gnat.dg/pack9.adb
@@ -1,5 +1,5 @@
 -- { dg-do compile }
--- { dg-options "-O2 -gnatp -cargs --param sra-max-structure-size=24 --param sra-max-structure-count=6 -fdump-tree-optimized" }
+-- { dg-options "-O2 -gnatp -cargs -fdump-tree-optimized" }
 
 package body Pack9 is
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]