diff mbox series

[4/9] Strengthen alias_ptr_types_compatible_p in LTO mode.

Message ID cd62592cc338ad6d97516e48137a97cb97489e2e.1565105736.git.mliska@suse.cz
State New
Headers show
Series IPA ICF overhaul | expand

Commit Message

Martin Liška June 4, 2019, 11:30 a.m. UTC
gcc/ChangeLog:

2019-07-24  Martin Liska  <mliska@suse.cz>

	* alias.c (alias_ptr_types_compatible_p): Strengten
	type comparison in LTO mode.
---
 gcc/alias.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Richard Biener Aug. 7, 2019, 11:57 a.m. UTC | #1
On Tue, Aug 6, 2019 at 5:43 PM Martin Liska <mliska@suse.cz> wrote:

This warrants a comment like

  /* This function originally abstracts from simply comparing
get_deref_alias_set
     so that we are sure this still computes the same result after LTO
type merging
     is applied.  When in LTO type merging is done we can actually do
this compare.  */
  if (in_lto_p)
    return get_deref_alias_set (t1) == get_deref_alias_set (t2);
...

also note you want to call get_deref_alias_set as mentioned in the
function comment.

OK with this change.

Thanks,
Richard.

> gcc/ChangeLog:
>
> 2019-07-24  Martin Liska  <mliska@suse.cz>
>
>         * alias.c (alias_ptr_types_compatible_p): Strengten
>         type comparison in LTO mode.
> ---
>  gcc/alias.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
Martin Liška Aug. 8, 2019, 10:04 a.m. UTC | #2
On 8/7/19 1:57 PM, Richard Biener wrote:
> On Tue, Aug 6, 2019 at 5:43 PM Martin Liska <mliska@suse.cz> wrote:
> 
> This warrants a comment like
> 
>   /* This function originally abstracts from simply comparing
> get_deref_alias_set
>      so that we are sure this still computes the same result after LTO
> type merging
>      is applied.  When in LTO type merging is done we can actually do
> this compare.  */
>   if (in_lto_p)
>     return get_deref_alias_set (t1) == get_deref_alias_set (t2);
> ...
> 
> also note you want to call get_deref_alias_set as mentioned in the
> function comment.

Thanks for review.

Hope it's addressed in the attached patch that I've just tested?

Martin

> 
> OK with this change.
> 
> Thanks,
> Richard.
> 
>> gcc/ChangeLog:
>>
>> 2019-07-24  Martin Liska  <mliska@suse.cz>
>>
>>         * alias.c (alias_ptr_types_compatible_p): Strengten
>>         type comparison in LTO mode.
>> ---
>>  gcc/alias.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
Richard Biener Aug. 9, 2019, 11:06 a.m. UTC | #3
On Thu, Aug 8, 2019 at 12:04 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 8/7/19 1:57 PM, Richard Biener wrote:
> > On Tue, Aug 6, 2019 at 5:43 PM Martin Liska <mliska@suse.cz> wrote:
> >
> > This warrants a comment like
> >
> >   /* This function originally abstracts from simply comparing
> > get_deref_alias_set
> >      so that we are sure this still computes the same result after LTO
> > type merging
> >      is applied.  When in LTO type merging is done we can actually do
> > this compare.  */
> >   if (in_lto_p)
> >     return get_deref_alias_set (t1) == get_deref_alias_set (t2);
> > ...
> >
> > also note you want to call get_deref_alias_set as mentioned in the
> > function comment.
>
> Thanks for review.
>
> Hope it's addressed in the attached patch that I've just tested?

Yes.
Thanks,
Richard.

> Martim
>
> >
> > OK with this change.
> >
> > Thanks,
> > Richard.
> >
> >> gcc/ChangeLog:
> >>
> >> 2019-07-24  Martin Liska  <mliska@suse.cz>
> >>
> >>         * alias.c (alias_ptr_types_compatible_p): Strengten
> >>         type comparison in LTO mode.
> >> ---
> >>  gcc/alias.c | 7 +++++--
> >>  1 file changed, 5 insertions(+), 2 deletions(-)
> >>
>
diff mbox series

Patch

diff --git a/gcc/alias.c b/gcc/alias.c
index 2755df72907..bae4ddaebaf 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -793,8 +793,11 @@  alias_ptr_types_compatible_p (tree t1, tree t2)
       || ref_all_alias_ptr_type_p (t2))
     return false;
 
-  return (TYPE_MAIN_VARIANT (TREE_TYPE (t1))
-	  == TYPE_MAIN_VARIANT (TREE_TYPE (t2)));
+  if (in_lto_p)
+    return get_alias_set (t1) == get_alias_set (t2);
+  else
+    return (TYPE_MAIN_VARIANT (TREE_TYPE (t1))
+	    == TYPE_MAIN_VARIANT (TREE_TYPE (t2)));
 }
 
 /* Create emptry alias set entry.  */