Bin Cheng, I did some testing on this now. The attached patch automatically increases the iterations for autofdo profiles.
But even with even more iterations I still have stable failures in FAIL: gcc.dg/tree-prof/cold_partition_label.c scan-assembler foo[._]+cold FAIL: gcc.dg/tree-prof/cold_partition_label.c scan-assembler size[ \ta-zA-Z0-0]+foo[._]+cold FAIL: gcc.dg/tree-prof/indir-call-prof.c scan-ipa-dump afdo "Indirect call -> direct call.* a1 transformation on insn" FAIL: gcc.dg/tree-prof/peel-1.c scan-tree-dump cunroll "Peeled loop ., 1 times" Did these really ever work for you? -Andi diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C index a9bdc167f45..02b01c073e9 100644 --- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C +++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C @@ -2,6 +2,10 @@ #include "reorder_class1.h" #include "reorder_class2.h" +#ifndef ITER +#define ITER 1000 +#endif + int g; #ifdef _PROFILE_USE @@ -19,7 +23,7 @@ static __attribute__((always_inline)) void test1 (A *tc) { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < ITER; i++) g += tc->foo(); if (g<100) g++; } @@ -28,7 +32,7 @@ static __attribute__((always_inline)) void test2 (B *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < ITER; i++) g += tc->foo(); } diff --git a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c index 450308d6407..099069da6a7 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c +++ b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c @@ -9,6 +9,10 @@ const char *sarr[SIZE]; const char *buf_hot; const char *buf_cold; +#ifndef ITER +#define ITER 1000000 +#endif + __attribute__((noinline)) void foo (int path) @@ -32,7 +36,7 @@ main (int argc, char *argv[]) int i; buf_hot = "hello"; buf_cold = "world"; - for (i = 0; i < 1000000; i++) + for (i = 0; i < ITER; i++) foo (argc); return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c b/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c index 58109d54dc7..32d22c69c6c 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c @@ -2,6 +2,10 @@ /* { dg-additional-sources "crossmodule-indircall-1a.c" } */ /* { dg-options "-O3 -flto -DDOJOB=1" } */ +#ifndef ITER +#define ITER 1000 +#endif + int a; extern void (*p[2])(int n); void abort (void); @@ -10,12 +14,12 @@ main() { int i; /* This call shall be converted. */ - for (i = 0;i<1000;i++) + for (i = 0;i<ITER;i++) p[0](1); /* This call shall not be converted. */ - for (i = 0;i<1000;i++) + for (i = 0;i<ITER;i++) p[i%2](2); - if (a != 1000) + if (a != ITER) abort (); return 0; diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c index 53063c3e7fa..8b9dfbb78c7 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c @@ -1,5 +1,9 @@ /* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile -fdump-ipa-afdo" } */ +#ifndef ITER +#define ITER 100000 +#endif + static int a1 (void) { return 10; @@ -28,7 +32,7 @@ main (void) int (*p) (void); int i; - for (i = 0; i < 10000000; i ++) + for (i = 0; i < ITER*100; i++) { setp (&p, i); p (); diff --git a/gcc/testsuite/gcc.dg/tree-prof/peel-1.c b/gcc/testsuite/gcc.dg/tree-prof/peel-1.c index 7245b68c1ee..b6ed178e1ad 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/peel-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/peel-1.c @@ -1,13 +1,17 @@ /* { dg-options "-O3 -fdump-tree-cunroll-details -fno-unroll-loops -fpeel-loops" } */ void abort(); -int a[1000]; +#ifndef ITER +#define ITER 1000 +#endif + +int a[ITER]; int __attribute__ ((noinline)) t() { int i; - for (i=0;i<1000;i++) + for (i=0;i<ITER;i++) if (!a[i]) return 1; abort (); @@ -16,7 +20,7 @@ int main() { int i; - for (i=0;i<1000;i++) + for (i=0;i<ITER;i++) t(); return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr52027.c b/gcc/testsuite/gcc.dg/tree-prof/pr52027.c index c46a14b2e86..bf2a83a336d 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/pr52027.c +++ b/gcc/testsuite/gcc.dg/tree-prof/pr52027.c @@ -2,6 +2,10 @@ /* { dg-require-effective-target freorder } */ /* { dg-options "-O2 -freorder-blocks-and-partition -fno-reorder-functions" } */ +#ifndef ITER +#define ITER 1000 +#endif + void foo (int len) { @@ -13,7 +17,7 @@ int main () { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < ITER; i++) foo (8); return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c index 1e64f284ac0..65570a5e96d 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c @@ -1,9 +1,14 @@ /* { dg-options "-O2 -ftracer -fdump-tree-tracer" } */ + +#ifndef ITER +#define ITER 1000 +#endif + volatile int a, b, c; int main () { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < ITER; i++) { if (i % 17) a++; diff --git a/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c b/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c index 3ad0cf019b3..3027e75a241 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c @@ -1,13 +1,17 @@ /* { dg-options "-O3 -fdump-rtl-loop2_unroll-details -funroll-loops -fno-peel-loops" } */ void abort (); -int a[1000]; +#ifndef ITER +#define ITER 1000 +#endif + +int a[ITER]; int __attribute__ ((noinline)) t() { int i; - for (i=0;i<1000;i++) + for (i=0;i<ITER;i++) if (!a[i]) return 1; abort (); @@ -16,7 +20,7 @@ int main() { int i; - for (i=0;i<1000;i++) + for (i=0;i<ITER;i++) t(); return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c b/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c index c286816cdf8..de2d03ebaee 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c @@ -1,5 +1,9 @@ - /* { dg-options "-O2 -fdump-tree-optimized-blocks" } */ + +#ifndef ITER +#define ITER 1000 +#endif + int a[8]; __attribute__ ((noinline)) int t() @@ -14,7 +18,7 @@ int main () { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < ITER; i++) t (); return 0; } diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp index 65494cfd4f6..13e7828bf32 100644 --- a/gcc/testsuite/lib/profopt.exp +++ b/gcc/testsuite/lib/profopt.exp @@ -289,8 +289,8 @@ proc auto-profopt-execute { src } { return } set profile_wrapper [profopt-perf-wrapper] - set profile_option "-g" - set feedback_option "-fauto-profile" + set profile_option "-g -DITER=1000000" + set feedback_option "-fauto-profile -DITER=1000000" set run_autofdo 1 profopt-execute $src unset profile_wrapper