public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Alan Lawrence <alan.lawrence@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	       Richard Biener <richard.guenther@gmail.com>
Subject: Re: [PATCH/RFC] Make loop-header-copying more aggressive, rerun before tree-if-conversion
Date: Tue, 23 Jun 2015 20:34:00 -0000	[thread overview]
Message-ID: <5589BFF8.5050200@redhat.com> (raw)
In-Reply-To: <55845395.3020306@arm.com>

On 06/19/2015 11:38 AM, Alan Lawrence wrote:
> Jeff Law wrote:
>> On 05/22/2015 09:42 AM, Alan Lawrence wrote:
>>> This patch does so (and makes slightly less conservative, to tackle the
>>> example above). I found I had to make this a separate pass, so that the
>>> phi nodes were cleaned up at the end of the pass before running
>>> tree_if_conversion.
>> What PHI node cleanup needs to be done?  I don't doubt something's
>> needed, but would like to understand the cleanup -- depending on what
>> needs to be done, it may be the case that we can cleanup on-the-fly or
>> it may point at a general issue we should be resolving prior to
>> running tree_if_conversion.
>
> If I change pass_ch_vect to return 0 rather than TODO_update_cfg, my
> testcase gives:
Thanks.  Does running the phi-only propagator after the loop header 
copying help?  At first glance it would seem that it ought to propagate 
the values of those degenerate PHIs then eliminate those PHIs.

It was written to cleanup after jump threading which has a tendency to 
create very similar code to what you've shown below and to do so very 
quickly.


/* A very simple pass to eliminate degenerate PHI nodes from the
    IL.  This is meant to be fast enough to be able to be run several
    times in the optimization pipeline.

    Certain optimizations, particularly those which duplicate blocks
    or remove edges from the CFG can create or expose PHIs which are
    trivial copies or constant initializations.

    While we could pick up these optimizations in DOM or with the
    combination of copy-prop and CCP, those solutions are far too
    heavy-weight for our needs.

    This implementation has two phases so that we can efficiently
    eliminate the first order degenerate PHIs and second order
    degenerate PHIs.

    The first phase performs a dominator walk to identify and eliminate
    the vast majority of the degenerate PHIs.  When a degenerate PHI
    is identified and eliminated any affected statements or PHIs
    are put on a worklist.

    The second phase eliminates degenerate PHIs and trivial copies
    or constant initializations using the worklist.  This is how we
    pick up the secondary optimization opportunities with minimal
    cost.  */

> I agree this isn't (/cannot be) totally definitive, so if you are not
> sufficiently reassured - would you be if I called loop_optimizer_init
> (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS) at the end of pass_ch_vect,
> redoing the setup done in pass_tree_loop_init::execute?
As I mentioned, I didn't have anything specific in mind, just a general 
concern.   No way to be totally definitive here.  I think you've done 
suitable due diligence.


>
> Patch v2 at https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01355.html .
Thanks.  It's in the queue again.  Two weeks of PTO has made that queue 
much deeper than I'd like, but I'm making progress :-)

jeff

  reply	other threads:[~2015-06-23 20:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 15:46 Alan Lawrence
2015-05-27 16:01 ` Jeff Law
2015-06-19 17:54   ` Alan Lawrence
2015-06-23 20:34     ` Jeff Law [this message]
2015-06-30 16:10       ` Alan Lawrence
2015-07-01 17:06         ` Jeff Law
2015-05-28 12:11 ` Richard Biener
2015-06-19 17:38   ` Alan Lawrence

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=5589BFF8.5050200@redhat.com \
    --to=law@redhat.com \
    --cc=alan.lawrence@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).