Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-05-01 Thread Xinliang David Li
On Sun, May 1, 2011 at 7:16 AM, Jan Hubicka  wrote:
>> How about  change "tree_profile_ipa" to "tree-profile" and
>> "ipa-profile" to "profile-estimate" -- basically drop the ipa in the
>> name. There are also many other passes using '_' though. Can tree
>> level pass_profile's name also be changed to 'profile-estimate'? Their
>> dump names won't collide.
>
> profile-estimate for tree and IPA passes seems fine.  I would drop tree from
> tree-profile pass name, too.  We no longer have RTL profiling.

I agree.

Thanks,

David

>
> Honza
>>
>> Thanks,
>>
>> David
>>
>>
>> > Honza
>> >>
>> >> David
>> >>
>> >> >
>> >> > Honza
>> >> >
>> >
>


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-05-01 Thread Jan Hubicka
> How about  change "tree_profile_ipa" to "tree-profile" and
> "ipa-profile" to "profile-estimate" -- basically drop the ipa in the
> name. There are also many other passes using '_' though. Can tree
> level pass_profile's name also be changed to 'profile-estimate'? Their
> dump names won't collide.

profile-estimate for tree and IPA passes seems fine.  I would drop tree from
tree-profile pass name, too.  We no longer have RTL profiling.

Honza
> 
> Thanks,
> 
> David
> 
> 
> > Honza
> >>
> >> David
> >>
> >> >
> >> > Honza
> >> >
> >


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-30 Thread Xinliang David Li
On Sat, Apr 30, 2011 at 10:07 AM, Jan Hubicka  wrote:
>> On Sat, Apr 30, 2011 at 2:21 AM, Jan Hubicka  wrote:
>> >> On Fri, Apr 29, 2011 at 4:16 PM, Jan Hubicka  wrote:
>> >> > Hi,
>> >> > It seems that majority of testcases are independent of lipo. We could 
>> >> > probably
>> >> > enjoy more of testing on mainline, so could you please take those 
>> >> > working on
>> >> > mainline and make mainline patch and let me know what of the tests are 
>> >> > not working
>> >> > there?
>> >>
>> >> Actually those test cases are cloned from tree-prof directory into the
>> >> lipo sub-directory. The difference is that lipo.exp file passes
>> >> additional -fripa flag.  The missing tests for LIPO are ones with
>> >> multiple source with non trivial module group testing -- I have not
>> >> added those yet.
>> >
>> > Hmm, the tests looked familiar so I wondered how redundant they are ;)
>> > Well, any tests that you do have for PDO and are not in mainlie are 
>> > welcome.
>> >>
>> >> >
>> >> > We probably ought to fix the pass name... We already have "ipa-profile" 
>> >> > for profile
>> >> > propagation.  What about "gcov", unless we could come with something 
>> >> > better?
>> >>
>> >> Yes -- tree_profile_ipa and ipa_profile confuses many people.
>> >
>> > If we won't get better idea, I would go with gcov.
>>
>> Maybe it is better to change ipa-profile to something like
>> ipa_freq_prop.   Gcov is the name for coverage --- though it is
>> related to profiling and FDO, and it can so be confusing.
>
> Well, pass_ipa_profile is at IPA level what pass_profile does at tree level,
> so we would need to rename both.  We could go with something like
> guess_profile as opposed to read profile, unless we come with anything better.
> gcov originales from coverage, indeed, but it is sort of used for the whole
> profiling/feedback infrastructure.
> I dunno what is better, both variants are fine with me.  Do we need to use _ 
> instead
> of - in pass names?  I quite dislike the -fdump-ipa-profile_estimate naming, 
> so
> I am usually trying to stick with one word pass names for this reason...
>

How about  change "tree_profile_ipa" to "tree-profile" and
"ipa-profile" to "profile-estimate" -- basically drop the ipa in the
name. There are also many other passes using '_' though. Can tree
level pass_profile's name also be changed to 'profile-estimate'? Their
dump names won't collide.

Thanks,

David


> Honza
>>
>> David
>>
>> >
>> > Honza
>> >
>


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-30 Thread Jan Hubicka
> On Sat, Apr 30, 2011 at 2:21 AM, Jan Hubicka  wrote:
> >> On Fri, Apr 29, 2011 at 4:16 PM, Jan Hubicka  wrote:
> >> > Hi,
> >> > It seems that majority of testcases are independent of lipo. We could 
> >> > probably
> >> > enjoy more of testing on mainline, so could you please take those 
> >> > working on
> >> > mainline and make mainline patch and let me know what of the tests are 
> >> > not working
> >> > there?
> >>
> >> Actually those test cases are cloned from tree-prof directory into the
> >> lipo sub-directory. The difference is that lipo.exp file passes
> >> additional -fripa flag.  The missing tests for LIPO are ones with
> >> multiple source with non trivial module group testing -- I have not
> >> added those yet.
> >
> > Hmm, the tests looked familiar so I wondered how redundant they are ;)
> > Well, any tests that you do have for PDO and are not in mainlie are welcome.
> >>
> >> >
> >> > We probably ought to fix the pass name... We already have "ipa-profile" 
> >> > for profile
> >> > propagation.  What about "gcov", unless we could come with something 
> >> > better?
> >>
> >> Yes -- tree_profile_ipa and ipa_profile confuses many people.
> >
> > If we won't get better idea, I would go with gcov.
> 
> Maybe it is better to change ipa-profile to something like
> ipa_freq_prop.   Gcov is the name for coverage --- though it is
> related to profiling and FDO, and it can so be confusing.

Well, pass_ipa_profile is at IPA level what pass_profile does at tree level,
so we would need to rename both.  We could go with something like
guess_profile as opposed to read profile, unless we come with anything better.
gcov originales from coverage, indeed, but it is sort of used for the whole
profiling/feedback infrastructure.
I dunno what is better, both variants are fine with me.  Do we need to use _ 
instead
of - in pass names?  I quite dislike the -fdump-ipa-profile_estimate naming, so
I am usually trying to stick with one word pass names for this reason...

Honza
> 
> David
> 
> >
> > Honza
> >


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-30 Thread Xinliang David Li
On Sat, Apr 30, 2011 at 2:21 AM, Jan Hubicka  wrote:
>> On Fri, Apr 29, 2011 at 4:16 PM, Jan Hubicka  wrote:
>> > Hi,
>> > It seems that majority of testcases are independent of lipo. We could 
>> > probably
>> > enjoy more of testing on mainline, so could you please take those working 
>> > on
>> > mainline and make mainline patch and let me know what of the tests are not 
>> > working
>> > there?
>>
>> Actually those test cases are cloned from tree-prof directory into the
>> lipo sub-directory. The difference is that lipo.exp file passes
>> additional -fripa flag.  The missing tests for LIPO are ones with
>> multiple source with non trivial module group testing -- I have not
>> added those yet.
>
> Hmm, the tests looked familiar so I wondered how redundant they are ;)
> Well, any tests that you do have for PDO and are not in mainlie are welcome.
>>
>> >
>> > We probably ought to fix the pass name... We already have "ipa-profile" 
>> > for profile
>> > propagation.  What about "gcov", unless we could come with something 
>> > better?
>>
>> Yes -- tree_profile_ipa and ipa_profile confuses many people.
>
> If we won't get better idea, I would go with gcov.

Maybe it is better to change ipa-profile to something like
ipa_freq_prop.   Gcov is the name for coverage --- though it is
related to profiling and FDO, and it can so be confusing.

David

>
> Honza
>


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-30 Thread Jan Hubicka
> On Fri, Apr 29, 2011 at 4:16 PM, Jan Hubicka  wrote:
> > Hi,
> > It seems that majority of testcases are independent of lipo. We could 
> > probably
> > enjoy more of testing on mainline, so could you please take those working on
> > mainline and make mainline patch and let me know what of the tests are not 
> > working
> > there?
> 
> Actually those test cases are cloned from tree-prof directory into the
> lipo sub-directory. The difference is that lipo.exp file passes
> additional -fripa flag.  The missing tests for LIPO are ones with
> multiple source with non trivial module group testing -- I have not
> added those yet.

Hmm, the tests looked familiar so I wondered how redundant they are ;)
Well, any tests that you do have for PDO and are not in mainlie are welcome.
> 
> >
> > We probably ought to fix the pass name... We already have "ipa-profile" for 
> > profile
> > propagation.  What about "gcov", unless we could come with something better?
> 
> Yes -- tree_profile_ipa and ipa_profile confuses many people.

If we won't get better idea, I would go with gcov.

Honza


Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-29 Thread Xinliang David Li
On Fri, Apr 29, 2011 at 4:16 PM, Jan Hubicka  wrote:
> Hi,
> It seems that majority of testcases are independent of lipo. We could probably
> enjoy more of testing on mainline, so could you please take those working on
> mainline and make mainline patch and let me know what of the tests are not 
> working
> there?

Actually those test cases are cloned from tree-prof directory into the
lipo sub-directory. The difference is that lipo.exp file passes
additional -fripa flag.  The missing tests for LIPO are ones with
multiple source with non trivial module group testing -- I have not
added those yet.

>
> We probably ought to fix the pass name... We already have "ipa-profile" for 
> profile
> propagation.  What about "gcov", unless we could come with something better?

Yes -- tree_profile_ipa and ipa_profile confuses many people.


>> +int a[1000];
>> +int b[1000];
>> +int size=1;
>> +int max=1;
>> +main()
>> +{
>> +  int i;
>> +  for (i=0;i> +    {
>> +      __builtin_memcpy (a, b, size * sizeof (a[0]));
>> +      asm("");
>> +    }
>> +   return 0;
>> +}
>> +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" 
>> "tree_profile_ipa"} } */
>> +/* 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 " = MEM.*&b" "optimized"} } */
>> +/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
>> +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
>> +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */
>> Index: testsuite/gcc.dg/tree-prof/lipo/pr34999.c
>> ===
>> --- testsuite/gcc.dg/tree-prof/lipo/pr34999.c (revision 0)
>> +++ testsuite/gcc.dg/tree-prof/lipo/pr34999.c (revision 0)
>> @@ -0,0 +1,45 @@
>> +/* Same test as built-in-setjmp.c.  Includes the case where
>> +   the source block of a crossing fallthru edge ends with a call.  */
>> +/* { dg-require-effective-target freorder } */
>> +/* { dg-options "-O2 -freorder-blocks-and-partition" } */
>> +
>> +extern int strcmp(const char *, const char *);
>> +extern char *strcpy(char *, const char *);
>> +extern void abort(void);
>> +extern void exit(int);
>> +
>> +void *buf[20];
>> +
>> +void __attribute__((noinline))
>> +sub2 (void)
>> +{
>> +  __builtin_longjmp (buf, 1);
>> +}
>> +
>> +int
>> +main ()
>> +{
>> +  char *p = (char *) __builtin_alloca (20);
>> +
>> +  strcpy (p, "test");
>> +
>> +  if (__builtin_setjmp (buf))
>> +    {
>> +      if (strcmp (p, "test") != 0)
>> +     abort ();
>> +
>> +      exit (0);
>> +    }
>> +
>> +  {
>> +    int *q = (int *) __builtin_alloca (p[2] * sizeof (int));
>> +    int i;
>> +
>> +    for (i = 0; i < p[2]; i++)
>> +      q[i] = 0;
>> +
>> +    while (1)
>> +      sub2 ();
>> +  }
>> +}
>> +
>> Index: testsuite/gcc.dg/tree-prof/lipo/stringop-2.c
>> ===
>> --- testsuite/gcc.dg/tree-prof/lipo/stringop-2.c      (revision 0)
>> +++ testsuite/gcc.dg/tree-prof/lipo/stringop-2.c      (revision 0)
>> @@ -0,0 +1,20 @@
>> +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */
>> +int a[1000];
>> +int b[1000];
>> +int size=1;
>> +int max=1;
>> +main()
>> +{
>> +  int i;
>> +  for (i=0;i> +    {
>> +      __builtin_memset (a, 10, size * sizeof (a[0]));
>> +      asm("");
>> +    }
>> +   return 0;
>> +}
>> +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" 
>> "tree_profile_ipa"} } */
>> +/* The versioned memset of size 4 should be optimized to an assignment.  */
>> +/* { dg-final-use { scan-tree-dump "a\\\[0\\\] = 168430090" "optimized"} } 
>> */
>> +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
>> +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */
>> Index: testsuite/gcc.dg/tree-prof/lipo/update-loopch.c
>> ===
>> --- testsuite/gcc.dg/tree-prof/lipo/update-loopch.c   (revision 0)
>> +++ testsuite/gcc.dg/tree-prof/lipo/update-loopch.c   (revision 0)
>> @@ -0,0 +1,21 @@
>> +/* { dg-options "-O2 -fdump-ipa-tree_profile_ipa-blocks 
>> -fdump-tree-optimized-blocks" } */
>> +int max = 3;
>> +int a[8];
>> +int
>> +main ()
>> +{
>> +  int i;
>> +  for (i = 0; i < max; i++)
>> +    {
>> +      a[i % 8]++;
>> +    }
>> +  return 0;
>> +}
>> +/* Loop header copying will peel away the initial conditional, so the loop 
>> body
>> +   is once reached directly from entry point of function, rest via loopback
>> +   edge.  */
>> +/* { dg-final-use { scan-ipa-dump "count:3" "tree_profile_ipa"} } */
>> +/* { dg-final-use { scan-tree-dump "count:2" "optimized"} } */
>> +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
>> +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */
>> +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
>> Index: 
>> testsuite/gcc.dg/tree-prof/lipo/indir-call-

Re: [google] LIPO regression tests and bug fixes (issue4444076)

2011-04-29 Thread Jan Hubicka
Hi,
It seems that majority of testcases are independent of lipo. We could probably
enjoy more of testing on mainline, so could you please take those working on
mainline and make mainline patch and let me know what of the tests are not 
working
there? 
> Index: testsuite/gcc.dg/tree-prof/lipo/inliner-1.c
> ===
> --- testsuite/gcc.dg/tree-prof/lipo/inliner-1.c   (revision 0)
> +++ testsuite/gcc.dg/tree-prof/lipo/inliner-1.c   (revision 0)
> @@ -0,0 +1,42 @@
> +/* { dg-options "-O2 -fdump-tree-optimized" } */
> +int a;
> +int b[100];
> +void abort (void);
> +
> +inline void
> +cold_function ()
> +{
> +  int i;
> +  for (i = 0; i < 99; i++)
> +if (b[i] / (b[i+1] + 1))
> +  abort ();
> +}
> +
> +inline void
> +hot_function ()
> +{
> +  int i;
> +  for (i = 0; i < 99; i++)
> +if (b[i] / (b[i+1] + 1))
> +  abort ();
> +}
> +
> +main ()
> +{
> +  int i;
> +  for (i = 0; i < 100; i++)
> +{
> +  if (a)
> +cold_function ();
> +  else
> +hot_function ();
> +}
> +  return 0;
> +}
> +
> +/* cold function should be inlined, while hot function should not.  
> +   Look for "cold_function () [tail call];" call statement not for the
> +   declaration or other apperances of the string in dump.  */
> +/* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */
> +/* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */
> +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
> Index: testsuite/gcc.dg/tree-prof/lipo/bb-reorg.c
> ===
> --- testsuite/gcc.dg/tree-prof/lipo/bb-reorg.c(revision 0)
> +++ testsuite/gcc.dg/tree-prof/lipo/bb-reorg.c(revision 0)
> @@ -0,0 +1,39 @@
> +/* { dg-require-effective-target freorder } */
> +/* { dg-options "-O2 -freorder-blocks-and-partition" } */
> +
> +#include 
> +
> +#define SIZE 1000
> +int t0 = 0;
> +const char *t2[SIZE];
> +char buf[SIZE];
> +
> +void
> +foo (void)
> +{
> +  char *s = buf;
> +  t0 = 1;
> +
> +  for (;;)
> +{
> +  if (*s == '\0')
> + break;
> +  else
> + {
> +   t2[t0] = s;
> +   t0++;
> + }
> +  *s++ = '\0';
> +}
> +  t2[t0] = NULL;
> +}
> +
> +
> +int
> +main ()
> +{
> +  strcpy (buf, "hello");
> +  foo ();
> +  return 0; 
> +}
> +
> Index: testsuite/gcc.dg/tree-prof/lipo/stringop-1.c
> ===
> --- testsuite/gcc.dg/tree-prof/lipo/stringop-1.c  (revision 0)
> +++ testsuite/gcc.dg/tree-prof/lipo/stringop-1.c  (revision 0)
> @@ -0,0 +1,22 @@
> +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */

We probably ought to fix the pass name... We already have "ipa-profile" for 
profile
propagation.  What about "gcov", unless we could come with something better?
> +int a[1000];
> +int b[1000];
> +int size=1;
> +int max=1;
> +main()
> +{
> +  int i;
> +  for (i=0;i +{
> +  __builtin_memcpy (a, b, size * sizeof (a[0]));
> +  asm("");
> +}
> +   return 0;
> +}
> +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" 
> "tree_profile_ipa"} } */
> +/* 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 " = MEM.*&b" "optimized"} } */
> +/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
> +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
> +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */
> Index: testsuite/gcc.dg/tree-prof/lipo/pr34999.c
> ===
> --- testsuite/gcc.dg/tree-prof/lipo/pr34999.c (revision 0)
> +++ testsuite/gcc.dg/tree-prof/lipo/pr34999.c (revision 0)
> @@ -0,0 +1,45 @@
> +/* Same test as built-in-setjmp.c.  Includes the case where
> +   the source block of a crossing fallthru edge ends with a call.  */
> +/* { dg-require-effective-target freorder } */
> +/* { dg-options "-O2 -freorder-blocks-and-partition" } */
> +
> +extern int strcmp(const char *, const char *);
> +extern char *strcpy(char *, const char *);
> +extern void abort(void);
> +extern void exit(int);
> +
> +void *buf[20];
> +
> +void __attribute__((noinline))
> +sub2 (void)
> +{
> +  __builtin_longjmp (buf, 1);
> +}
> +
> +int
> +main ()
> +{
> +  char *p = (char *) __builtin_alloca (20);
> +
> +  strcpy (p, "test");
> +
> +  if (__builtin_setjmp (buf))
> +{
> +  if (strcmp (p, "test") != 0)
> + abort ();
> +
> +  exit (0);
> +}
> +
> +  {
> +int *q = (int *) __builtin_alloca (p[2] * sizeof (int));
> +int i;
> +
> +for (i = 0; i < p[2]; i++)
> +  q[i] = 0;
> +
> +while (1)
> +  sub2 ();
> +  }
> +}
> +
> Index: testsuite/gcc.dg/tree-prof/lipo/stringop-2.c
> ===
> --- testsuite/gcc.