echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1_$$component_in_prev.fda; \
- $(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; \
fi; \
done;
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1_$$component_in_prev_target.fda; \
- $(CREATE_GCOV) -binary ../prev-gcc/cc1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
+ $(CREATE_GCOV) -binary ../prev-gcc/cc1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \
fi; \
done;
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1plus_$$component_in_prev.fda; \
- $(CREATE_GCOV) -binary ../stage1-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
+ $(CREATE_GCOV) -binary ../stage1-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \
fi; \
done;
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=cc1plus_$$component_in_prev_target.fda; \
- $(CREATE_GCOV) -binary ../prev-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
+ $(CREATE_GCOV) -binary ../prev-gcc/cc1plus$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \
fi; \
done;
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=lto1_$$component_in_prev.fda; \
- $(CREATE_GCOV) -binary ../stage1-gcc/lto1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
+ $(CREATE_GCOV) -binary ../stage1-gcc/lto1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \
fi; \
done;
echo $$perf_path; \
if [ -f $$perf_path ]; then \
profile_name=lto1_$$component_in_prev_target.fda; \
- $(CREATE_GCOV) -binary ../prev-gcc/lto1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2 || exit 1; \
+ $(CREATE_GCOV) -binary ../prev-gcc/lto1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 3 || exit 1; \
fi; \
done;
--- /dev/null
+/* { 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 } } */
--- /dev/null
+/* { 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 } } */
--- /dev/null
+/* { 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 } } */
--- /dev/null
+__attribute__ ((noinline, noipa)) static void effect_1 () {}
+__attribute__ ((noinline, noipa)) static void effect_2 () {}
+__attribute__ ((noinline, noipa)) static int foo () { return 5; }
--- /dev/null
+/* { 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 } } */
--- /dev/null
+__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(); }
# 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 } {