diff mbox

Fix indirect call optimization done by autoFDO.

Message ID dc01fe0c-9101-9c57-3401-bbff63d742a3@suse.cz
State New
Headers show

Commit Message

Martin Liška July 11, 2017, 10:37 a.m. UTC
Hello.

Following is a typo fix which nobody has noticed during testing of
e.g. gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c.


Patch can bootstrap and survives regression tests.

Ready for trunk?
Thanks,
Martin


gcc/ChangeLog:

2017-07-11  Martin Liska  <mliska@suse.cz>

	* auto-profile.c (autofdo_source_profile::update_inlined_ind_target):
	Fix wrong condition.
---
  gcc/auto-profile.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jeff Law July 26, 2017, 5:22 p.m. UTC | #1
On 07/11/2017 04:37 AM, Martin Liška wrote:
> Hello.
> 
> Following is a typo fix which nobody has noticed during testing of
> e.g. gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c.
> 
> 
> Patch can bootstrap and survives regression tests.
> 
> Ready for trunk?
> Thanks,
> Martin
> 
> 
> gcc/ChangeLog:
> 
> 2017-07-11  Martin Liska  <mliska@suse.cz>
> 
>     * auto-profile.c (autofdo_source_profile::update_inlined_ind_target):
>     Fix wrong condition.
The preceeding comment says

"If it is no less than half of the callsite count (stored in INFO), the
original promoted target is considered not hot anymore."

"it" presumably refers to TOTAL  and INFO->count holds the callsite count.

A direct translation would result in

! (total < info->count / 2)

Which is equivalent to

(total >= info->count / 2)

Which seems to match the code.

So is the comment wrong?  Or is my interpretation wrong?

jeff
Martin Liška July 27, 2017, 12:54 p.m. UTC | #2
On 07/26/2017 07:22 PM, Jeff Law wrote:
> So is the comment wrong?  Or is my interpretation wrong?
> 
> jeff

Yes, comment needs adjustment, done that in r250622.

Thanks for review,
Martin
diff mbox

Patch

diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index 334f38be109..d8b0d04bf15 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -777,12 +777,12 @@  autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
      count of the unpromoted targets (stored in old_info). If it is no less
      than half of the callsite count (stored in INFO), the original promoted
      target is considered not hot any more.  */
-  if (total >= info->count / 2)
+  if (info->count < total / 2)
     {
       if (dump_file)
-	fprintf (dump_file, " not hot anymore %ld >= %ld",
-		 (long)total,
-		 (long)info->count /2);
+	fprintf (dump_file, " not hot anymore %ld < %ld",
+		 (long)info->count,
+		 (long)total /2);
       return false;
     }