public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF.
@ 2020-02-17 15:21 Martin Liška
  2020-02-18 10:20 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Liška @ 2020-02-17 15:21 UTC (permalink / raw)
  To: gcc-patches

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

Hi.

The patch is extension of 446096148ca9775cb56f9ee924fa283babcd0b76 commit
where we need to handle FIX_TRUNC_EXPR in compare_gimple_assign.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2020-02-17  Martin Liska  <mliska@suse.cz>

	PR ipa/92518
	* ipa-icf-gimple.c (func_checker::compare_gimple_assign):
	Consider also FIX_TRUNC_EXPR.
---
  gcc/ipa-icf-gimple.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)



[-- Attachment #2: 0001-Compare-more-sensitive-FIX_TRUNC_EXPR-in-IPA-ICF.patch --]
[-- Type: text/x-patch, Size: 599 bytes --]

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index fa71a028c66..4a4f06b79b4 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -621,7 +621,9 @@ func_checker::compare_gimple_assign (gimple *s1, gimple *s2)
       arg2 = gimple_op (s2, i);
 
       /* LHS types of NOP_EXPR must be compatible.  */
-      if (CONVERT_EXPR_CODE_P (code1) && i == 0)
+      if ((CONVERT_EXPR_CODE_P (code1)
+	   || code1 == FIX_TRUNC_EXPR)
+	  && i == 0)
 	{
 	  if (!compatible_types_p (TREE_TYPE (arg1), TREE_TYPE (arg2)))
 	    return return_false_with_msg ("GIMPLE NOP LHS type mismatch");


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

* Re: [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF.
  2020-02-17 15:21 [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF Martin Liška
@ 2020-02-18 10:20 ` Richard Biener
  2020-02-18 14:01   ` Martin Liška
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2020-02-18 10:20 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Mon, Feb 17, 2020 at 4:21 PM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> The patch is extension of 446096148ca9775cb56f9ee924fa283babcd0b76 commit
> where we need to handle FIX_TRUNC_EXPR in compare_gimple_assign.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?

There's also FLOAT_EXPR.

I wonder why you can ever disregard comparing the types of the LHS?  Yes,
comparing is most of the time redundant but OTOH comparing the LHS
types would be enough for all SSA defs and then you can elide comparing
of SSA use types in way more cases?!

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> 2020-02-17  Martin Liska  <mliska@suse.cz>
>
>         PR ipa/92518
>         * ipa-icf-gimple.c (func_checker::compare_gimple_assign):
>         Consider also FIX_TRUNC_EXPR.
> ---
>   gcc/ipa-icf-gimple.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
>

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

* Re: [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF.
  2020-02-18 10:20 ` Richard Biener
@ 2020-02-18 14:01   ` Martin Liška
  2020-02-18 14:02     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Liška @ 2020-02-18 14:01 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

On 2/18/20 11:19 AM, Richard Biener wrote:
> On Mon, Feb 17, 2020 at 4:21 PM Martin Liška <mliska@suse.cz> wrote:
>>
>> Hi.
>>
>> The patch is extension of 446096148ca9775cb56f9ee924fa283babcd0b76 commit
>> where we need to handle FIX_TRUNC_EXPR in compare_gimple_assign.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
> 
> There's also FLOAT_EXPR.
> 
> I wonder why you can ever disregard comparing the types of the LHS?  Yes,
> comparing is most of the time redundant but OTOH comparing the LHS
> types would be enough for all SSA defs and then you can elide comparing
> of SSA use types in way more cases?!

All right, let's compare LHS types for all gimple_assigns.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

> 
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2020-02-17  Martin Liska  <mliska@suse.cz>
>>
>>          PR ipa/92518
>>          * ipa-icf-gimple.c (func_checker::compare_gimple_assign):
>>          Consider also FIX_TRUNC_EXPR.
>> ---
>>    gcc/ipa-icf-gimple.c | 4 +++-
>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>
>>


[-- Attachment #2: 0001-Always-compare-types-of-LHS-for-gimple_assign-in-ICF.patch --]
[-- Type: text/x-patch, Size: 1084 bytes --]

From 8d656664a0d6e3c5acf6a42ab46d66edfb05d281 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 17 Feb 2020 14:56:09 +0100
Subject: [PATCH] Always compare types of LHS for gimple_assign in ICF.

gcc/ChangeLog:

2020-02-17  Martin Liska  <mliska@suse.cz>

	PR ipa/92518
	* ipa-icf-gimple.c (func_checker::compare_gimple_assign):
	Always compare LHS of gimple_assign.
---
 gcc/ipa-icf-gimple.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index fa71a028c66..3e5b2d4bd6d 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -620,8 +620,8 @@ func_checker::compare_gimple_assign (gimple *s1, gimple *s2)
       arg1 = gimple_op (s1, i);
       arg2 = gimple_op (s2, i);
 
-      /* LHS types of NOP_EXPR must be compatible.  */
-      if (CONVERT_EXPR_CODE_P (code1) && i == 0)
+      /* Compare types for LHS.  */
+      if (i == 0)
 	{
 	  if (!compatible_types_p (TREE_TYPE (arg1), TREE_TYPE (arg2)))
 	    return return_false_with_msg ("GIMPLE NOP LHS type mismatch");
-- 
2.25.0


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

* Re: [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF.
  2020-02-18 14:01   ` Martin Liška
@ 2020-02-18 14:02     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2020-02-18 14:02 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Tue, Feb 18, 2020 at 3:00 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 2/18/20 11:19 AM, Richard Biener wrote:
> > On Mon, Feb 17, 2020 at 4:21 PM Martin Liška <mliska@suse.cz> wrote:
> >>
> >> Hi.
> >>
> >> The patch is extension of 446096148ca9775cb56f9ee924fa283babcd0b76 commit
> >> where we need to handle FIX_TRUNC_EXPR in compare_gimple_assign.
> >>
> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >>
> >> Ready to be installed?
> >
> > There's also FLOAT_EXPR.
> >
> > I wonder why you can ever disregard comparing the types of the LHS?  Yes,
> > comparing is most of the time redundant but OTOH comparing the LHS
> > types would be enough for all SSA defs and then you can elide comparing
> > of SSA use types in way more cases?!
>
> All right, let's compare LHS types for all gimple_assigns.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?

OK.

> Thanks,
> Martin
>
> >
> >> Thanks,
> >> Martin
> >>
> >> gcc/ChangeLog:
> >>
> >> 2020-02-17  Martin Liska  <mliska@suse.cz>
> >>
> >>          PR ipa/92518
> >>          * ipa-icf-gimple.c (func_checker::compare_gimple_assign):
> >>          Consider also FIX_TRUNC_EXPR.
> >> ---
> >>    gcc/ipa-icf-gimple.c | 4 +++-
> >>    1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >>
>

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

end of thread, other threads:[~2020-02-18 14:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 15:21 [PATCH] Compare more sensitive FIX_TRUNC_EXPR in IPA ICF Martin Liška
2020-02-18 10:20 ` Richard Biener
2020-02-18 14:01   ` Martin Liška
2020-02-18 14:02     ` Richard Biener

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).