From f9ad3d5339faaaed6e15a7b27d90fbc66eb72f37 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Mon, 2 Aug 2021 17:12:04 -0700 Subject: [PATCH] Fixes for AutoFDO tests * Changed several tests to use -fdump-ipa-afdo-optimized instead of -fdump-ipa-afdo in dg-options so that the expected output can be found * Increased the number of iterations in several tests so that perf can have enough sampling events Contributes to fixing PR gcov-profile/71672. gcc/testsuite/ChangeLog: * g++.dg/tree-prof/indir-call-prof.C: Fix options, increase the number of iterations. * g++.dg/tree-prof/morefunc.C: Fix options, increase the number of iterations. * g++.dg/tree-prof/reorder.C: Fix options, increase the number of iterations. * gcc.dg/tree-prof/indir-call-prof-2.c: Fix options, increase the number of iterations. * gcc.dg/tree-prof/indir-call-prof.c: Fix options. --- gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C | 4 ++-- gcc/testsuite/g++.dg/tree-prof/morefunc.C | 7 ++++--- gcc/testsuite/g++.dg/tree-prof/reorder.C | 6 +++--- gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c | 2 +- gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C index 3374744613ea..b45417106d0f 100644 --- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C +++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */ struct A { A () {} @@ -26,7 +26,7 @@ main (void) int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) { p = (A *)wrap ((void *)&a); p->AA (); diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C index 621d09aec5b3..96e0073ca8f9 100644 --- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C +++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C @@ -1,4 +1,5 @@ -/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */ +/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */ + #include "reorder_class1.h" #include "reorder_class2.h" @@ -19,7 +20,7 @@ static __attribute__((always_inline)) void test1 (A *tc) { int i; - for (i = 0; i < 1000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); if (g<100) g++; } @@ -28,7 +29,7 @@ static __attribute__((always_inline)) void test2 (B *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); } diff --git a/gcc/testsuite/g++.dg/tree-prof/reorder.C b/gcc/testsuite/g++.dg/tree-prof/reorder.C index 000fb651a692..504909633698 100644 --- a/gcc/testsuite/g++.dg/tree-prof/reorder.C +++ b/gcc/testsuite/g++.dg/tree-prof/reorder.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo -Wno-coverage-mismatch -Wno-attributes" } */ +/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-coverage-mismatch -Wno-attributes" } */ #ifdef _PROFILE_USE #include "reorder_class1.h" @@ -13,7 +13,7 @@ static __attribute__((always_inline)) void test1 (A *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); if (g<100) g++; } @@ -22,7 +22,7 @@ static __attribute__((always_inline)) void test2 (B *tc) { int i; - for (i = 0; i < 1000000; i++) + for (i = 0; i < 10000000; i++) g += tc->foo(); } diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c index bbba0521018b..258532654223 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c @@ -22,7 +22,7 @@ int main (void) { int i, val = 0; - for (i = 0; i < 100000; i++) + for (i = 0; i < 10000000; i++) { val = do_op (val, add1); val = do_op (val, sub1); 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 138b85a08d2a..702045239f3f 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */ static int a1 (void) { -- 2.47.2