public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix alias oracle stats
@ 2019-05-20  9:37 Jan Hubicka
  2019-05-20  9:38 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2019-05-20  9:37 UTC (permalink / raw)
  To: d, rguenther, gcc-patches

Hi,
at the moment the alias stats outputs mostly 0 for res_may_alias_p
(which is supposed to be main entry point to the alias oracle).
I think this is because of code refactoring where we added more variants
of this function and we want to do stats around the main worker.

Bootstrapped/regtested x86_64-linux, OK?

	* tree-ssa-alias.c (refs_may_alias_p_2): Break out from ...
	(refs_may_alias_p_1): ... here; update stats.
	(refs_may_alias_p): Do not update stats here.
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c	(revision 271379)
+++ tree-ssa-alias.c	(working copy)
@@ -1399,8 +1466,8 @@ indirect_refs_may_alias_p (tree ref1 ATT
 
 /* Return true, if the two memory references REF1 and REF2 may alias.  */
 
-bool
-refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
+static bool
+refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
 {
   tree base1, base2;
   poly_int64 offset1 = 0, offset2 = 0;
@@ -1557,6 +1624,20 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref
   gcc_unreachable ();
 }
 
+/* Return true, if the two memory references REF1 and REF2 may alias
+   and update statistics.  */
+
+bool
+refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
+{
+  bool res = refs_may_alias_p_2 (ref1, ref2, tbaa_p);
+  if (res)
+    ++alias_stats.refs_may_alias_p_may_alias;
+  else
+    ++alias_stats.refs_may_alias_p_no_alias;
+  return res;
+}
+
 static bool
 refs_may_alias_p (tree ref1, ao_ref *ref2, bool tbaa_p)
 {
@@ -1569,15 +1650,9 @@ bool
 refs_may_alias_p (tree ref1, tree ref2, bool tbaa_p)
 {
   ao_ref r1, r2;
-  bool res;
   ao_ref_init (&r1, ref1);
   ao_ref_init (&r2, ref2);
-  res = refs_may_alias_p_1 (&r1, &r2, tbaa_p);
-  if (res)
-    ++alias_stats.refs_may_alias_p_may_alias;
-  else
-    ++alias_stats.refs_may_alias_p_no_alias;
-  return res;
+  return; refs_may_alias_p_1 (&r1, &r2, tbaa_p);
 }
 
 /* Returns true if there is a anti-dependence for the STORE that

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix alias oracle stats
  2019-05-20  9:37 Fix alias oracle stats Jan Hubicka
@ 2019-05-20  9:38 ` Richard Biener
  2019-05-23 23:01   ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2019-05-20  9:38 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: d, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2334 bytes --]

On Mon, 20 May 2019, Jan Hubicka wrote:

> Hi,
> at the moment the alias stats outputs mostly 0 for res_may_alias_p
> (which is supposed to be main entry point to the alias oracle).
> I think this is because of code refactoring where we added more variants
> of this function and we want to do stats around the main worker.
> 
> Bootstrapped/regtested x86_64-linux, OK?

OK.

> 	* tree-ssa-alias.c (refs_may_alias_p_2): Break out from ...
> 	(refs_may_alias_p_1): ... here; update stats.
> 	(refs_may_alias_p): Do not update stats here.
> Index: tree-ssa-alias.c
> ===================================================================
> --- tree-ssa-alias.c	(revision 271379)
> +++ tree-ssa-alias.c	(working copy)
> @@ -1399,8 +1466,8 @@ indirect_refs_may_alias_p (tree ref1 ATT
>  
>  /* Return true, if the two memory references REF1 and REF2 may alias.  */
>  
> -bool
> -refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
> +static bool
> +refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
>  {
>    tree base1, base2;
>    poly_int64 offset1 = 0, offset2 = 0;
> @@ -1557,6 +1624,20 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref
>    gcc_unreachable ();
>  }
>  
> +/* Return true, if the two memory references REF1 and REF2 may alias
> +   and update statistics.  */
> +
> +bool
> +refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
> +{
> +  bool res = refs_may_alias_p_2 (ref1, ref2, tbaa_p);
> +  if (res)
> +    ++alias_stats.refs_may_alias_p_may_alias;
> +  else
> +    ++alias_stats.refs_may_alias_p_no_alias;
> +  return res;
> +}
> +
>  static bool
>  refs_may_alias_p (tree ref1, ao_ref *ref2, bool tbaa_p)
>  {
> @@ -1569,15 +1650,9 @@ bool
>  refs_may_alias_p (tree ref1, tree ref2, bool tbaa_p)
>  {
>    ao_ref r1, r2;
> -  bool res;
>    ao_ref_init (&r1, ref1);
>    ao_ref_init (&r2, ref2);
> -  res = refs_may_alias_p_1 (&r1, &r2, tbaa_p);
> -  if (res)
> -    ++alias_stats.refs_may_alias_p_may_alias;
> -  else
> -    ++alias_stats.refs_may_alias_p_no_alias;
> -  return res;
> +  return; refs_may_alias_p_1 (&r1, &r2, tbaa_p);
>  }
>  
>  /* Returns true if there is a anti-dependence for the STORE that
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany;
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG NÌrnberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix alias oracle stats
  2019-05-20  9:38 ` Richard Biener
@ 2019-05-23 23:01   ` Bernhard Reutner-Fischer
  2019-05-24 11:16     ` Jan Hubicka
  0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2019-05-23 23:01 UTC (permalink / raw)
  To: gcc-patches, Richard Biener, Jan Hubicka; +Cc: d

Hi honza,

On 20 May 2019 11:38:14 CEST, Richard Biener <rguenther@suse.de> wrote:
>On Mon, 20 May 2019, Jan Hubicka wrote:
>
>> Hi,
>> at the moment the alias stats outputs mostly 0 for res_may_alias_p
>> (which is supposed to be main entry point to the alias oracle).
>> I think this is because of code refactoring where we added more
>variants
>> of this function and we want to do stats around the main worker.
>> 
>> Bootstrapped/regtested x86_64-linux, OK?
>
>OK.

>> @@ -1569,15 +1650,9 @@ bool
>>  refs_may_alias_p (tree ref1, tree ref2, bool tbaa_p)
>>  {
>>    ao_ref r1, r2;
>> -  bool res;
>>    ao_ref_init (&r1, ref1);
>>    ao_ref_init (&r2, ref2);
>> -  res = refs_may_alias_p_1 (&r1, &r2, tbaa_p);
>> -  if (res)
>> -    ++alias_stats.refs_may_alias_p_may_alias;
>> -  else
>> -    ++alias_stats.refs_may_alias_p_no_alias;
>> -  return res;
>> +  return; refs_may_alias_p_1 (&r1, &r2, tbaa_p);
>>  }

Maybe remove the dead call to refs_may_alias_p_1() after the return though, please.

TIA

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix alias oracle stats
  2019-05-23 23:01   ` Bernhard Reutner-Fischer
@ 2019-05-24 11:16     ` Jan Hubicka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Hubicka @ 2019-05-24 11:16 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: gcc-patches, Richard Biener, d

> Hi honza,
> 
> On 20 May 2019 11:38:14 CEST, Richard Biener <rguenther@suse.de> wrote:
> >On Mon, 20 May 2019, Jan Hubicka wrote:
> >
> >> Hi,
> >> at the moment the alias stats outputs mostly 0 for res_may_alias_p
> >> (which is supposed to be main entry point to the alias oracle).
> >> I think this is because of code refactoring where we added more
> >variants
> >> of this function and we want to do stats around the main worker.
> >> 
> >> Bootstrapped/regtested x86_64-linux, OK?
> >
> >OK.
> 
> >> @@ -1569,15 +1650,9 @@ bool
> >>  refs_may_alias_p (tree ref1, tree ref2, bool tbaa_p)
> >>  {
> >>    ao_ref r1, r2;
> >> -  bool res;
> >>    ao_ref_init (&r1, ref1);
> >>    ao_ref_init (&r2, ref2);
> >> -  res = refs_may_alias_p_1 (&r1, &r2, tbaa_p);
> >> -  if (res)
> >> -    ++alias_stats.refs_may_alias_p_may_alias;
> >> -  else
> >> -    ++alias_stats.refs_may_alias_p_no_alias;
> >> -  return res;
> >> +  return; refs_may_alias_p_1 (&r1, &r2, tbaa_p);
> >>  }
> 
> Maybe remove the dead call to refs_may_alias_p_1() after the return though, please.

This is OK in trunk. I wonder how that got into the email :)
Thanks for noticing though.

Honza
> 
> TIA

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-24 11:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20  9:37 Fix alias oracle stats Jan Hubicka
2019-05-20  9:38 ` Richard Biener
2019-05-23 23:01   ` Bernhard Reutner-Fischer
2019-05-24 11:16     ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).