public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Andrew Pinski <pinskia@gmail.com>,
	Bernd Edlinger <bernd.edlinger@hotmail.de>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Andrew Pinski <apinski@marvell.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCHv2] Add a couple of A?CST1:CST2 match and simplify optimizations
Date: Wed, 26 May 2021 13:29:37 -0400	[thread overview]
Message-ID: <2633443f-c467-c627-0180-d03c38b994ba@redhat.com> (raw)
In-Reply-To: <CA+=Sn1n0W45wFF8hvY2TkTo1h6CD9Uz2j6TLG4YP4J4ptprxFA@mail.gmail.com>

On 5/26/21 7:07 AM, Andrew Pinski wrote:
> On Wed, May 26, 2021 at 2:01 AM Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, May 26, 2021 at 1:43 AM Bernd Edlinger
>> <bernd.edlinger@hotmail.de> wrote:
>>> On 5/25/21 4:22 PM, Richard Biener via Gcc-patches wrote:
>>>> On Sun, May 23, 2021 at 12:03 PM apinski--- via Gcc-patches
>>>> <gcc-patches@gcc.gnu.org> wrote:
>>>>> From: Andrew Pinski <apinski@marvell.com>
>>>>>
>>>>> Instead of some of the more manual optimizations inside phi-opt,
>>>>> it would be good idea to do a lot of the heavy lifting inside match
>>>>> and simplify instead. In the process, this moves the three simple
>>>>> A?CST1:CST2 (where CST1 or CST2 is zero) simplifications.
>>>>>
>>>>> OK? Boostrapped and tested on x86_64-linux-gnu with no regressions.
>>>>>
>>>>> Differences from V1:
>>>>> * Use bit_xor 1 instead of bit_not to fix the problem with boolean types
>>>>> which are not 1 bit precision.
>>>> OK.
>>>>
>>>> Thanks,
>>>> Richard.
>>>>
>>> Hmm, sorry, no luck.
>>>
>>> I think this caused:
>> If anything it is a bad interaction with changes between r12-1046 and
>> r12-1053; I am suspecting a bug in those changes rather than my
>> changes causing the bug.  Debugging it right now.
> (gdb) p debug_tree(name)
>   <ssa_name 0x7ffff6a5cd38
>      type <boolean_type 0x7ffff6b45b28 _Bool public unsigned QI
>          size <integer_cst 0x7ffff6b2bdc8 constant 8>
>          unit-size <integer_cst 0x7ffff6b2bde0 constant 1>
>          align:8 warn_if_not_align:0 symtab:0 alias-set -1
> canonical-type 0x7ffff6b45b28 precision:1 min <integer_cst
> 0x7ffff6b4a030 0> max <integer_cst 0x7ffff6b4a060 1>>
>
>      def_stmt _19 = ~_8;
>      version:19>
>
> So what is happening is evrp converted:
> ct_12 = ct_5 + -1;
> Into
> ct_12 = ct_5 == 1 ? 0 : 1;
> (this was done before my patch)
> And then it gets simplified to:
>    _8 = ct_5 == 1;
>    _19 = ~_8;
>    ct_12 = (int) _19;
> (after my match.pd patch)
>
> Which is correct, but the range code is not expecting new SSA names to
> be added .....
> It looks like the issue was introduced with r12-1048 (Add imports and
> strengthen the export definition in range_def and gori_map).
> I suspect there are other match.pd patterns which would also hit this
> issue where a new ssa name is introduced.
>
> I have no idea how to get this fixed because gimple-range-* is new to
> me; I tried looking into it but calling has_def_chain/get_def_chain
> inside register_dependency seems wrong, maybe Andrew MacLeod can help
> here.
> This happens even with a stage 1 gcc so it is not miscompiling.
>
> Also sorry for the breakage, I was not expecting it this time around
> as I ran bootstrap like three times and I did not expect an
> interaction with other parts of the compiler like this.
>
> Thanks,
> Andrew Pinski
>
>
>>
Yeah, not your fault, mine.  I'm sure it would have shown up very soon 
elsewhere, you were just the unlucky victim.

Sorry about that.

Andrew




  parent reply	other threads:[~2021-05-26 17:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-23  9:41 apinski
2021-05-25 14:22 ` Richard Biener
2021-05-26  8:28   ` Bernd Edlinger
2021-05-26  9:01     ` Andrew Pinski
2021-05-26 11:07       ` Andrew Pinski
2021-05-26 11:27         ` Richard Biener
2021-05-26 11:37           ` Andrew Pinski
2021-05-26 12:05             ` Richard Biener
2021-05-26 16:59               ` Andrew MacLeod
2021-05-26 17:03               ` Bernd Edlinger
2021-05-26 17:07                 ` Bernd Edlinger
2021-05-26 17:15                   ` Andrew MacLeod
2021-05-26 16:54         ` Aldy Hernandez
2021-05-26 17:29         ` Andrew MacLeod [this message]
2021-05-28  4:53           ` Jeff Law
2021-05-28  7:16             ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2633443f-c467-c627-0180-d03c38b994ba@redhat.com \
    --to=amacleod@redhat.com \
    --cc=apinski@marvell.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).