diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c new file mode 100644 index 0000000..574a085 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-crossmodule-1.c @@ -0,0 +1,29 @@ +/* { dg-require-effective-target lto } */ +/* { dg-additional-sources "afdo-crossmodule-1b.c" } */ +/* { dg-options "-O3 -flto -fdump-ipa-afdo_offline -fdump-tree-einline-details" } */ +/* { dg-require-profiling "-fauto-profile" } */ +volatile int c; + +int foo2 () +{ + c++; + return 1; +} +int foo (int (*fooptr) ()) +{ + return fooptr (); +} +extern int bar (int (*fooptr) (int (*)())); + +int +main() +{ + int n = 1000000; + int s = 0; + for (int i = 0; i < n; i++) + s += bar (foo); + return n != s; +} +/* { dg-final-use-autofdo { scan-ipa-dump "Removing external inline: main:5 bar" "afdo_offline"} } */ +/* { dg-final-use-autofdo { scan-ipa-dump "Offlining function inlined to other module: bar:2 foo" "afdo_offline"} } */ +/* { dg-final-use-autofdo { scan-tree-dump "Indirect call -> speculative call foo.. => foo2" "einline"} } */ |