> From: Dhruv Chawla <[email protected]>
> 
> Signed-off-by: Dhruv Chawla <[email protected]>
> 
> gcc/c/ChangeLog:
> 
>       * Make-lang.in: Bump GCOV version to 3.
> 
> gcc/cp/ChangeLog:
> 
>       * Make-lang.in: Bump GCOV version to 3.
> 
> gcc/lto/ChangeLog:
> 
>       * Make-lang.in: Bump GCOV version to 3.

> -         $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov 
> $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
> +         $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov 
> $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \

I wonder if we want to have an option for GCC to print gcov version, so
one can do somehting like
 --gcov_vesion `gcc --print-gcov-version`
and be future proof.

I suppose starting with next release we may want to try to provide an
update path for existing profiles.

Patch is OK,
thanks!
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-0.c 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-0.c
> new file mode 100644
> index 00000000000..551e5a8a425
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-0.c
> @@ -0,0 +1,47 @@
> +/* { dg-require-effective-target lto } */
> +/* { dg-additional-sources "afdo-lto_priv-basic-1.c" } */
> +/* { dg-options "-O2 -flto -fdump-ipa-afdo" } */
> +/* { dg-require-profiling "-fauto-profile" } */ 
> +
> +#define TRIP 1000000000
> +
> +/* Check against exported symbols.  */
> +__attribute__ ((noinline, noipa)) void effect_1 () {}
> +__attribute__ ((noinline, noipa)) void effect_2 () {}
> +__attribute__ ((noinline, noipa)) static int foo () { return 5; }
> +
> +/* Prevent GCC from optimizing the loop.  */
> +__attribute__ ((noinline, noipa)) int
> +use (int x)
> +{
> +  volatile int y = x;
> +  return x;
> +}
> +
> +extern void global ();
> +
> +int
> +main ()
> +{
> +  for (int i = 0; i < TRIP; i++)
> +    {
> +      /* Call only 50% of the time.  */
> +      if (use (i) < TRIP / 2)
> +     global ();
> +
> +      if (foo () < 5)
> +     /* This function is never called.  */
> +     effect_1 ();
> +      else
> +     effect_2 ();
> +    }
> +}
> +
> +/* Check that the annotation actually occurs.  */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for main" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for use" afdo 
> } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for foo" afdo 
> } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_2" 
> afdo } } */
> +
> +/* There should be no collision with effect_1 from afdo-lto_priv-basic-1.c.  
> */
> +/* { dg-final-use-autofdo { scan-ipa-dump "No afdo profile for effect_1" 
> afdo } } */
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-1.c 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-1.c
> new file mode 100644
> index 00000000000..38601d1a38e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-basic-1.c
> @@ -0,0 +1,20 @@
> +/* { dg-require-effective-target lto } */
> +/* { dg-additional-sources "afdo-lto_priv-basic-0.c" } */
> +/* { dg-options "-O2 -flto -fdump-ipa-afdo" } */
> +/* { dg-require-profiling "-fauto-profile" } */ 
> +
> +__attribute__((noinline, noipa)) static void do_nothing() {}
> +__attribute__((noinline, noipa)) static void effect_1() { do_nothing(); }
> +__attribute__((noinline, noipa)) static void effect_2() { do_nothing(); }
> +
> +void global()
> +{
> +  effect_1();
> +  effect_2();
> +}
> +
> +/* Check that the annotation actually occurs.  */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for global" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_2" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_1" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for 
> do_nothing" afdo } } */
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.c 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.c
> new file mode 100644
> index 00000000000..b30412284c6
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.c
> @@ -0,0 +1,47 @@
> +/* { dg-require-effective-target lto } */
> +/* { dg-additional-sources "afdo-lto_priv-header-1.c" } */
> +/* { dg-options "-O2 -flto -fdump-ipa-afdo" } */
> +/* { dg-require-profiling "-fauto-profile" } */ 
> +
> +/* Verify that symbols included from headers get their file names set and
> +   compared correctly.  */
> +
> +#define TRIP 1000000000
> +
> +#include "afdo-lto_priv-header-0.h"
> +
> +/* Prevent GCC from optimizing the loop.  */
> +__attribute__ ((noinline, noipa)) int
> +use (int x)
> +{
> +  volatile int y = x;
> +  return x;
> +}
> +
> +extern void global ();
> +
> +int
> +main ()
> +{
> +  for (int i = 0; i < TRIP; i++)
> +    {
> +      /* Call only 50% of the time.  */
> +      if (use (i) < TRIP / 2)
> +     global ();
> +
> +      if (foo () < 5)
> +     /* This function is never called.  */
> +     effect_1 ();
> +      else
> +     effect_2 ();
> +    }
> +}
> +
> +/* Check that the annotation actually occurs.  */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for main" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for use" afdo 
> } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for foo" afdo 
> } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_2" 
> afdo } } */
> +
> +/* There should be no collision with effect_1 from afdo-lto_priv-header-1.c. 
>  */
> +/* { dg-final-use-autofdo { scan-ipa-dump "No afdo profile for effect_1" 
> afdo } } */
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.h 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.h
> new file mode 100644
> index 00000000000..ee2a14d8eca
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-0.h
> @@ -0,0 +1,3 @@
> +__attribute__ ((noinline, noipa)) static void effect_1 () {}
> +__attribute__ ((noinline, noipa)) static void effect_2 () {}
> +__attribute__ ((noinline, noipa)) static int foo () { return 5; }
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.c 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.c
> new file mode 100644
> index 00000000000..b9dfe92676e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.c
> @@ -0,0 +1,18 @@
> +/* { dg-require-effective-target lto } */
> +/* { dg-additional-sources "afdo-lto_priv-header-0.c" } */
> +/* { dg-options "-O2 -flto -fdump-ipa-afdo" } */
> +/* { dg-require-profiling "-fauto-profile" } */ 
> +
> +#include "afdo-lto_priv-header-1.h"
> +
> +void global()
> +{
> +  effect_1();
> +  effect_2();
> +}
> +
> +/* Check that the annotation actually occurs.  */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for global" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_2" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for effect_1" 
> afdo } } */
> +/* { dg-final-use-autofdo { scan-ipa-dump-not "No afdo profile for 
> do_nothing" afdo } } */
> diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.h 
> b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.h
> new file mode 100644
> index 00000000000..249c97081d3
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-lto_priv-header-1.h
> @@ -0,0 +1,3 @@
> +__attribute__((noinline, noipa)) static void do_nothing() {}
> +__attribute__((noinline, noipa)) static void effect_1() { do_nothing(); }
> +__attribute__((noinline, noipa)) static void effect_2() { do_nothing(); }
> diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
> index 81d86c632d1..0001f6798dd 100644
> --- a/gcc/testsuite/lib/profopt.exp
> +++ b/gcc/testsuite/lib/profopt.exp
> @@ -452,7 +452,7 @@ proc profopt-execute { src } {
>           # convert profile
>           if { $run_autofdo == 1 } {
>                  set bprefix "afdo."
> -             set cmd "create_gcov --binary $execname1 
> --profile=$tmpdir/$base.perf.data -gcov_version=2 
> --gcov=$tmpdir/$bprefix$base.$ext"
> +             set cmd "create_gcov --binary $execname1 
> --profile=$tmpdir/$base.perf.data --gcov_version=3 
> --gcov=$tmpdir/$bprefix$base.$ext"
>               verbose "Running $cmd"
>               set id [remote_spawn "" $cmd]
>               if { $id < 0 } {
> -- 
> 2.44.0
> 

Reply via email to