public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Qing Zhao <qing.zhao@oracle.com>,
	GCC Development <gcc@gcc.gnu.org>,
	gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: A bug in vrp_meet?
Date: Tue, 19 Mar 2019 19:53:00 -0000	[thread overview]
Message-ID: <d37a0591-2f8b-6c52-9e35-b8a47728d3d6@redhat.com> (raw)
In-Reply-To: <CAFiYyc2=W_eO_b73=7LRw2HT2NtPAHF7gPtejOnUFZJnMRFcQw@mail.gmail.com>

On 3/6/19 3:05 AM, Richard Biener wrote:
> On Tue, Mar 5, 2019 at 10:36 PM Jeff Law <law@redhat.com> wrote:
>>
>> On 3/5/19 7:44 AM, Richard Biener wrote:
>>
>>> So fixing it properly with also re-optimize_stmt those stmts so we'd CSE
>>> the MAX_EXPR introduced by folding makes it somewhat ugly.
>>>
>>> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>>>
>>> Any ideas how to make it less so?  I can split out making optimize_stmt
>>> take a gsi * btw, in case that's a more obvious change and it makes the
>>> patch a little smaller.
>>>
>>> Richard.
>>>
>>> 2019-03-05  Richard Biener  <rguenther@suse.de>
>>>
>>>         PR tree-optimization/89595
>>>         * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take
>>>         stmt iterator as reference, take boolean output parameter to
>>>         indicate whether the stmt was removed and thus the iterator
>>>         already advanced.
>>>         (dom_opt_dom_walker::before_dom_children): Re-iterate over
>>>         stmts created by folding.
>>>
>>>         * gcc.dg/torture/pr89595.c: New testcase.
>>>
>>
>> Well, all the real logic changs are in the before_dom_children method.
>> The bits in optimize_stmt are trivial enough to effectively ignore.
>>
>> I don't see a better way to discover and process statements that are
>> created in the bowels of fold_stmt.
> 
> I'm not entirely happy so I created the following alternative which
> is a bit larger and slower due to the pre-pass clearing the visited flag
> but is IMHO easier to follow.  I guess there's plenty of TLC opportunity
> here but then I also hope to retire the VN parts of DOM in favor
> of the non-iterating RPO-VN code...
> 
> So - I'd lean to this variant even though it has the extra loop over stmts,
> would you agree?
> 
> Bootstrap / regtest running on x86_64-unknown-linux-gnu.
> 
> Richard.
> 
> 2019-03-06  Richard Biener  <rguenther@suse.de>
> 
>         PR tree-optimization/89595
>         * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take
>         stmt iterator as reference, take boolean output parameter to
>         indicate whether the stmt was removed and thus the iterator
>         already advanced.
>         (dom_opt_dom_walker::before_dom_children): Re-iterate over
>         stmts created by folding.
> 
>         * gcc.dg/torture/pr89595.c: New testcase.
This one is easier to follow from a logic standpoint.  I don't think the
gimple_set_visited bits are going to be terribly expensive in general.

Is that flag in a known state for new statements?  I'm guessing it's
cleared by some structure-sized memset as we create the raw statement?

Might be worth clarifying that in the comments in gimple.h.

jeff

  parent reply	other threads:[~2019-03-19 19:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 17:05 Qing Zhao
2019-02-28 19:54 ` Jeff Law
2019-03-01 17:49   ` Qing Zhao
2019-03-01 19:25     ` Richard Biener
2019-03-01 21:02       ` Qing Zhao
2019-03-04 11:45         ` Richard Biener
2019-03-04 16:09           ` Qing Zhao
2019-03-04 22:01           ` Qing Zhao
2019-03-05  9:48             ` Richard Biener
2019-03-05 10:44               ` Richard Biener
2019-03-05 14:45                 ` Richard Biener
2019-03-05 21:36                   ` Jeff Law
2019-03-06 10:06                     ` Richard Biener
2019-03-07 12:47                       ` Richard Biener
2019-05-05 21:09                         ` Eric Botcazou
2019-05-06 11:27                           ` Richard Biener
2019-03-19 19:53                       ` Jeff Law [this message]
2019-03-20  8:27                         ` Richard Biener
2019-03-05 21:27           ` Jeff Law
2019-03-05 21:17     ` Jeff Law

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=d37a0591-2f8b-6c52-9e35-b8a47728d3d6@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=qing.zhao@oracle.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).