diff mbox

Empty static constructor folding

Message ID 20100914162838.GD22498@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Sept. 14, 2010, 4:28 p.m. UTC
> On Mon, Sep 13, 2010 at 01:04:45PM -0700, Andrew Pinski wrote:
> > On Mon, Sep 13, 2010 at 12:55 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > > It seems that those testcases just need some obstructation to avoid folding.  I wonder how I make varianble public in fortran?
> > 
> > The easy way is to put the variables in a module and then do a "use
> > module".  Right now the variables in the program are really local to
> > the function (either auto or static depending on the size of the array
> > in this case they are huge so they are static).
> 
> Or you can add
>   common // a, b, c
> or
>   call fill (a, b)
> with
> subroutine fill(a, b)                                                                                                                             
>   integer, parameter :: kp = 4                                                                                                                    
>   integer, parameter :: n = 2000                                                                                                                  
>   complex(kp), dimension(n,n) :: a,b                                                                                                              
>   a = 1                                                                                                                                           
>   b = 1                                                                                                                                           
> end subroutine fill                                                                                                                               
> or something similar.

Thanks, I believe making them common is precisely what I want to get original
behaviour.  So I comitted the following.  It fixed the testcase for me.

Comments

Jan Hubicka Sept. 14, 2010, 4:34 p.m. UTC | #1
Hi,
this fixes the other testcase.  I am affraid that empty consturctor folding
actually caused more testsuite fuzz than real world change (we probably now fold
some more testcases to nothing), but hope we did not lost too much of coverage.

Honza

Index: gcc.target/i386/funcspec-1.c
===================================================================
*** gcc.target/i386/funcspec-1.c	(revision 164250)
--- gcc.target/i386/funcspec-1.c	(working copy)
***************
*** 12,20 ****
  #define SIZE 1024
  #endif
  
! static float a[SIZE] __attribute__((__aligned__(16)));
! static float b[SIZE] __attribute__((__aligned__(16)));
! static float c[SIZE] __attribute__((__aligned__(16)));
  
  void sse_addnums (void) __attribute__ ((__target__ ("sse2")));
  
--- 12,20 ----
  #define SIZE 1024
  #endif
  
! float a[SIZE] __attribute__((__aligned__(16)));
! float b[SIZE] __attribute__((__aligned__(16)));
! float c[SIZE] __attribute__((__aligned__(16)));
  
  void sse_addnums (void) __attribute__ ((__target__ ("sse2")));
  
Index: ChangeLog
===================================================================
*** ChangeLog	(revision 164282)
--- ChangeLog	(working copy)
***************
*** 2,7 ****
--- 2,9 ----
  
  	* gfortran.dg/vect/fast-math-pr38968.f90: Add common to prevent
  	folding.
+ 	* gcc.target/i386/funcspec-1.c: Remove static keywords to prevent
+ 	folding.
  
  2010-09-14  Jakub Jelinek  <jakub@redhat.com>
diff mbox

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 164281)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2010-09-14  Jan Hubicka  <jh@suse.cz>
+
+	* gfortran.dg/vect/fast-math-pr38968.f90: Add common to prevent
+	folding.
+
 2010-09-14  Jakub Jelinek  <jakub@redhat.com>
 
 	PR middle-end/45567
Index: gfortran.dg/vect/fast-math-pr38968.f90
===================================================================
--- gfortran.dg/vect/fast-math-pr38968.f90	(revision 164250)
+++ gfortran.dg/vect/fast-math-pr38968.f90	(working copy)
@@ -10,6 +10,7 @@  program mymatmul
   complex(kp), dimension(n,n) :: a,b,c
   real :: t1, t2
   integer :: i, j, k
+  common // a,b,c
 
   do j = 1, n
      do k = 1, n