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]

Re: [testsuite, pretty-ipa?] Changes to gcc.dg/ipa tests so that they pass on pretty-ipa


Hi,

On Wed, Mar 24, 2010 at 04:13:06PM +0100, Jan Hubicka wrote:
> > OK, the modified patch is below.  It now also contains modifications
> > to g++.dg/ipa/iinline-1.C since that testcase falls into the same
> > category.
> 
> In a way GCC might be creative enough to conclude that 100 iterations per program
> execution is not enough for code size optimization, but I guess we won't go for that
> (because we would end up with another dificult to tune parameter).
> It might be safer to thus have global variable determining number of iterations but I am fine
> with the patch as it is.  So it is OK.

I can always add a few zeroes :-) But lets deal with that after the
problem manifests itself.

> > 
> > BTW, the rest of the failures seem to be caused by the fact that main
> > is considered to be cold and there is no interprocedural element to
> > it.  Thus I intend to "fix" them by marking main with the hot
> > attribute.
> 
> Hmm, ipa-cp should not prevent propagation _from_ main just because main itself
> is known to be executed once (i.e. by propagating constants out one does not increase
> code size).  So there should be no need for adding hot attribute.  What precisely
> goes wrong here?

This has nothing to do with IPA-CP or anything interprocedural.  It's
testcases like: gcc.dg/tree-ssa/loadpre1.c in which some optimizations
we check for do not occur in main (often the only function in the
testcase) because of profitability estimates.

Thanks,

Martin

> 
> Honza
> > 
> > I have tested the patch on trunk on i686-linux by running the modified
> > testcases from within make check.  OK for trunk?
> > 
> > Thanks,
> > 
> > Martin
> > 
> > 
> > 2010-03-24  Martin Jambor  <mjambor@suse.cz>
> > 
> > 	* gcc.dg/ipa/ipa-1.c: Delete trailing spaces, put the call to f into
> > 	a loop.	
> > 	* gcc.dg/ipa/ipa-2.c: Likewise.
> > 	* gcc.dg/ipa/ipa-3.c: Likewise.
> > 	* gcc.dg/ipa/ipa-4.c: Likewise.
> > 	* gcc.dg/ipa/ipa-5.c: Likewise.
> > 	* gcc.dg/ipa/ipa-7.c: Likewise.
> > 	* gcc.dg/ipa/ipa-6.c: Delete trailing spaces, put the call to foo into
> > 	a loop.
> > 	* gcc.dg/ipa/ipacost-2.c: Delete trailing spaces, put the call to
> > 	i_can_not_be_propagated_fully2 into a loop.
> > 	* gcc.dg/ipa/ipa-8.c: New test.
> > 	* g++.dg/ipa/iinline-1.C: Put the call to docalling into a loop.
> > 
> > 
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> > @@ -13,12 +13,14 @@ int f (int a)
> >    if (a > 0)
> >      g (a, 3);
> >    else
> > -    g (a, 5); 	
> > +    g (a, 5);
> >  }
> >  int main ()
> >  {
> > -  f (7);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> > @@ -15,8 +15,10 @@ int f (int a)
> >  }
> >  int main ()
> >  {
> > -  f (7);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> > @@ -10,19 +10,21 @@ void t(void);
> >  int g (double b, double c)
> >  {
> >    t();
> > -  return (int)(b+c);  
> > +  return (int)(b+c);
> >  }
> >  int f (double a)
> >  {
> >    if (a > 0)
> >      g (a, 3.1);
> >    else
> > -    g (a, 3.1); 	
> > +    g (a, 3.1);
> >  }
> >  int main ()
> >  {
> > -  f (7.44);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7.44);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> > @@ -9,17 +9,19 @@ int g (int b, int c)
> >  }
> >  int f (int a)
> >  {
> > -  /* First and second parameter of g gets different values.  */ 
> > -     
> > +  /* First and second parameter of g gets different values.  */
> > +
> >    if (a > 0)
> >      g (a, 3);
> >    else
> > -    g (a+1, 5); 	
> > +    g (a+1, 5);
> >  }
> >  int main ()
> >  {
> > -  f (7);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> > @@ -20,8 +20,10 @@ int f (float a)
> >  }
> >  int main ()
> >  {
> > -  f (7.6);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7.6);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-6.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-6.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-6.c
> > @@ -23,7 +23,9 @@ foo (int a)
> >  int
> >  main ()
> >  {
> > -  foo (7);
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    foo (7);
> >    return 0;
> >  }
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> > @@ -13,14 +13,16 @@ int f (int a)
> >    if (a > 0)
> >      g (a, 3);
> >    else
> > -    g (a, 5); 	
> > -   
> > +    g (a, 5);
> > +
> >    send_addr (&a);
> >  }
> >  int main ()
> >  {
> > -  f (7);
> > -  return 0;	
> > +  int i;
> > +  for (i = 0; i < 100; i++)
> > +    f (7);
> > +  return 0;
> >  }
> >  
> >  
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> > @@ -6,7 +6,7 @@ int array[100];
> >  
> >  int t(int);
> >  
> > -static int 
> > +static int
> >  i_can_be_propagated_fully (int *a)
> >  {
> >    int i;
> > @@ -18,14 +18,14 @@ i_can_be_propagated_fully (int *a)
> >      t(a[i+3]);
> >    }
> >  }
> > -static int 
> > +static int
> >  i_can_be_propagated_fully2 (int *a)
> >  {
> >    i_can_be_propagated_fully (a);
> >    i_can_be_propagated_fully (a);
> >    i_can_be_propagated_fully (a);
> >  }
> > -static int 
> > +static int
> >  i_can_not_be_propagated_fully (int *a)
> >  {
> >    int i;
> > @@ -37,7 +37,7 @@ i_can_not_be_propagated_fully (int *a)
> >      t(a[i+3]);
> >    }
> >  }
> > -int 
> > +int
> >  i_can_not_be_propagated_fully2 (int *a)
> >  {
> >    i_can_not_be_propagated_fully (a);
> > @@ -46,9 +46,12 @@ i_can_not_be_propagated_fully2 (int *a)
> >  }
> >  main()
> >  {
> > +  int i;
> >    i_can_be_propagated_fully2 (array);
> >    i_can_be_propagated_fully2 (array);
> > -  i_can_not_be_propagated_fully2 (array);
> > +
> > +  for (i = 0; i < 100; i++)
> > +    i_can_not_be_propagated_fully2 (array);
> >    i_can_not_be_propagated_fully2 (array);
> >  }
> >  
> > Index: pipa/gcc/testsuite/g++.dg/ipa/iinline-1.C
> > ===================================================================
> > --- pipa.orig/gcc/testsuite/g++.dg/ipa/iinline-1.C
> > +++ pipa/gcc/testsuite/g++.dg/ipa/iinline-1.C
> > @@ -38,8 +38,9 @@ int docalling (int (String::* f)(int del
> >  
> >  int main (int argc, char *argv[])
> >  {
> > -  int i;
> > -  i = docalling (&String::funcOne);
> > +  int i = 0;
> > +  while (i < 1000)
> > +    i += docalling (&String::funcOne);
> >    non_existent ("done", i);
> >    return 0;
> >  }
> > Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-8.c
> > ===================================================================
> > --- /dev/null
> > +++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-8.c
> > @@ -0,0 +1,30 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
> > +/* { dg-add-options bind_pic_locally } */
> > +
> > +#include <stdio.h>
> > +static int g (int b, int c)
> > +{
> > +  printf ("%d %d\n", b, c);
> > +}
> > +static int f (int a)
> > +{
> > +  /* Second parameter of g gets different values.  */
> > +  if (a > 0)
> > +    g (a, 3);
> > +  else
> > +    g (a, 5);
> > +}
> > +int main ()
> > +{
> > +  f (7);
> > +  return 0;
> > +}
> > +
> > +
> > +/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp"  } } */
> > +/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp"  } } */
> > +/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp"  } } */
> > +/* { dg-final { cleanup-ipa-dump "cp" } } */
> > +
> > +


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