Fix indir-call-prof-2.c with AutoFDO

indir-call-prof-2.c has -fno-early-inlining but AutoFDO can't work without
early inlining (it needs to match the inlining of the profiled binary).
I changed profopt.exp to always pass -fearly-inlining for AutoFDO.
With that change the indirect call inlining in indir-call-prof-2.c happens in the early inliner
so I changed the dg-final-use-autofdo.

Contributes to fixing PR gcov-profile/71672

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-prof/indir-call-prof-2.c: Fix dg-final-use-autofdo.
	* lib/profopt.exp: Pass -fearly-inlining when compiling with AutoFDO.
This commit is contained in:
Eugene Rozenfeld 2021-08-02 17:22:34 -07:00
parent f9ad3d5339
commit 0ed093c7c3
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-ipa-afdo" } */
/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-tree-einline-optimized" } */
volatile int one;
static int
add1 (int val)
@ -31,5 +31,5 @@ main (void)
}
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "profile"} } */
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "profile"} } */
/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "afdo"} } */
/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "afdo"} } */
/* { dg-final-use-autofdo { scan-tree-dump "Inlining add1/1 into main/4." "einline"} } */
/* { dg-final-use-autofdo { scan-tree-dump "Inlining sub1/2 into main/4." "einline"} } */

View File

@ -290,7 +290,7 @@ proc auto-profopt-execute { src } {
}
set profile_wrapper [profopt-perf-wrapper]
set profile_option "-g -DFOR_AUTOFDO_TESTING"
set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING"
set feedback_option "-fauto-profile -DFOR_AUTOFDO_TESTING -fearly-inlining"
set run_autofdo 1
profopt-execute $src
unset profile_wrapper