public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] tree-optimization/109237 - last_stmt is possibly slow
Date: Wed, 22 Mar 2023 13:38:13 +0100	[thread overview]
Message-ID: <ZBr2tUJ+28h3o/Zc@tucnak> (raw)
In-Reply-To: <90515.123032208295400168@us-mta-397.us.mimecast.lan>

On Wed, Mar 22, 2023 at 12:29:52PM +0000, Richard Biener wrote:
> Most uses of last_stmt are interested in control transfer stmts
> and for the testcase gimple_purge_dead_eh_edges shows up in
> the profile.  But last_stmt looks past trailing debug stmts but
> those would be rejected by GIMPLEs verify_flow_info.  The following
> adds possible_ctrl_stmt besides last_stmt which does not look
> past trailing debug stmts and adjusts gimple_purge_dead_eh_edges.
> 
> I've put checking code into possible_ctrl_stmt that it will not
> miss a control statement if the real last stmt is a debug stmt.
> 
> The alternative would be to change last_stmt, explicitely introducing
> last_nondebug_stmt.  I remember we chickened out and made last_stmt
> conservative here but not anticipating the compile-time issues this
> creates.  I count 227 last_stmt and 12 last_and_only_stmt uses.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Any opinions?  I probably lean towards s/last_stmt/last_nondebug_stmt/
> in next stage1 and then adding last_stmt and changing some
> uses back - through for maintainance that's going to be a
> nightmare (or maybe not, a "wrong" last_stmt should be safe to
> backport and a last_nondebug_stmt will fail to build).
> 
> Richard.
> 
> 	PR tree-optimization/109237
> 	* tree-cfg.h (possible_ctrl_stmt): New function returning
> 	the last stmt not skipping debug stmts.
> 	(gimple_purge_dead_eh_edges): Use it.

LGTM.  But finding out which of those 227+12 calls want to skip
debug stmts and which don't will be a nightmare...

	Jakub


       reply	other threads:[~2023-03-22 12:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <90515.123032208295400168@us-mta-397.us.mimecast.lan>
2023-03-22 12:38 ` Jakub Jelinek [this message]
     [not found] <20230322123006.A480C3858296@sourceware.org>
2023-03-26 18:00 ` Jeff Law
     [not found] <20230322123020.B9718385B533@sourceware.org>
2023-03-22 16:50 ` Bernhard Reutner-Fischer
2023-03-22 12:29 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=ZBr2tUJ+28h3o/Zc@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).