diff mbox series

Compare more sensitive FIX_TRUNC_EXPR in IPA ICF.

Message ID 3cbfc86f-d274-8edd-573c-b501a163de8c@suse.cz
State New
Headers show
Series Compare more sensitive FIX_TRUNC_EXPR in IPA ICF. | expand

Commit Message

Martin Liška Feb. 17, 2020, 3:21 p.m. UTC
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(-)

Comments

Richard Biener Feb. 18, 2020, 10:19 a.m. UTC | #1
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(-)
>
>
Martin Liška Feb. 18, 2020, 2 p.m. UTC | #2
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(-)
>>
>>
Richard Biener Feb. 18, 2020, 2:02 p.m. UTC | #3
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(-)
> >>
> >>
>
diff mbox series

Patch

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");