Message ID | 6afadfdf-2c42-5070-483a-579538f66468@suse.cz |
---|---|
State | New |
Headers | show |
Series | Fix setting of hotness in non-LTO mode (PR gcov-profile/77698). | expand |
PING^1 On 10/9/18 2:37 PM, Martin Liška wrote: > Hi. > > In non-LTO mode, we should not set hotness according to computed histogram > in ipa-profile. Following patch does that and fixes the test-case isolated > from PR. > > Patch survives regression tests on x86_64-linux-gnu. > Ready for trunk? > Thanks, > Martin > > gcc/ChangeLog: > > 2018-10-09 Martin Liska <mliska@suse.cz> > > PR gcov-profile/77698 > * ipa-profile.c (ipa_profile): Adjust hotness threshold > only in LTO mode. > > gcc/testsuite/ChangeLog: > > 2018-10-09 Martin Liska <mliska@suse.cz> > > PR gcov-profile/77698 > * gcc.dg/tree-prof/pr77698.c: New test. > --- > gcc/ipa-profile.c | 5 ++--- > gcc/testsuite/gcc.dg/tree-prof/pr77698.c | 23 +++++++++++++++++++++++ > 2 files changed, 25 insertions(+), 3 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr77698.c > >
On 10/9/18 6:37 AM, Martin Liška wrote: > Hi. > > In non-LTO mode, we should not set hotness according to computed histogram > in ipa-profile. Following patch does that and fixes the test-case isolated > from PR. > > Patch survives regression tests on x86_64-linux-gnu. > Ready for trunk? > Thanks, > Martin > > gcc/ChangeLog: > > 2018-10-09 Martin Liska <mliska@suse.cz> > > PR gcov-profile/77698 > * ipa-profile.c (ipa_profile): Adjust hotness threshold > only in LTO mode. > > gcc/testsuite/ChangeLog: > > 2018-10-09 Martin Liska <mliska@suse.cz> > > PR gcov-profile/77698 > * gcc.dg/tree-prof/pr77698.c: New test. OK jeff
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c index c74f4a4a41d..7065af59ba9 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -533,11 +533,10 @@ ipa_profile (void) cumulated_size * 100.0 / overall_size); } - if (threshold > get_hot_bb_threshold () - || in_lto_p) + if (in_lto_p) { if (dump_file) - fprintf (dump_file, "Threshold updated.\n"); + fprintf (dump_file, "Setting hotness threshold in LTO mode.\n"); set_hot_bb_threshold (threshold); } } diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr77698.c b/gcc/testsuite/gcc.dg/tree-prof/pr77698.c new file mode 100644 index 00000000000..201bfc7ee20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/pr77698.c @@ -0,0 +1,23 @@ +/* { dg-options "-O2 -fno-tree-vectorize -funroll-loops --param max-unroll-times=4 -fno-inline -fdump-rtl-alignments" } */ + +volatile long int g; +volatile long int j = 0; + +void foo(long int *a, long int *b, long int n) +{ + long int i; + + for (i = 0; i < n; i++) + a[j] = *b; +} + +long int a, b; +int main() +{ + a = 1; b = 2; + foo(&a, &b, 1000000); + g = a+b; + return 0; +} + +/* { dg-final-use-not-autofdo { scan-rtl-dump-times "internal loop alignment added" 1 "alignments"} } */