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

Jan Hubicka hubicka@ucw.cz
Fri Apr 29 23:28:00 GMT 2011


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 <string.h>
> +
> +#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=10000;
> +main()
> +{
> +  int i;
> +  for (i=0;i<max; 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=10000;
> +main()
> +{
> +  int i;
> +  for (i=0;i<max; 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 = 33333;
> +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:33333" "tree_profile_ipa"} } */
> +/* { dg-final-use { scan-tree-dump "count:33332" "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-prof.c.040i.tree_profile_ipa
> ===================================================================
> --- testsuite/gcc.dg/tree-prof/lipo/indir-call-prof.c.040i.tree_profile_ipa	(revision 0)
> +++ testsuite/gcc.dg/tree-prof/lipo/indir-call-prof.c.040i.tree_profile_ipa	(revision 0)

Suprious add?

Thanks,
Honza



More information about the Gcc-patches mailing list