From: Richard Biener <rguenther@suse.de>
To: Tom de Vries <tdevries@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Remove verify_no_unreachable_blocks
Date: Thu, 23 Aug 2018 12:06:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1808231359450.16707@zhemvz.fhfr.qr> (raw)
In-Reply-To: <4c82136a-7370-1a20-337b-e8c5a480ffab@suse.de>
On Thu, 23 Aug 2018, Tom de Vries wrote:
> On 08/23/2018 01:18 PM, Richard Biener wrote:
> > This removes verify_no_unreachable_blocks and implements checking
> > for unreachable blocks in inverted_post_order_compute by simply
> > looking if we reach a block without predecessors that is not the
> > entry block.
> >
>
> I think that doesn't detect unreachable cyles: say you have blocks A and
> B, and A -> B -> A.
Ah, true. Bah, I guess I can use some other flag in my pass.
> > This solves a problem I ran into when (ab-)using BB_REACHABLE
> > in a pass and I got comparison failues because of -fchecking vs.
> > -fno-checking. It also should speed up checking builds.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> >
> > Tom, does this make sense?
> >
>
> The intent of the check I added was to verify the assumption stated in
> the comment. I don't know how serious it is if the assumption is violated.
I think if you have reverse-not-reachable blocks (infinite loops w/o
fake exit edges) that are not reachable from entry it will ICE
or loop infintely.
Richard.
> Thanks,
> - Tom
>
> > Thanks,
> > Richard.
> >
> > 2018-08-23 Richard Biener <rguenther@suse.de>
> >
> > * cfganal.h (verify_no_unreachable_blocks): Remove.
> > * cfganal.c (verify_no_unreachable_blocks): Likewise.
> > (inverted_post_order_compute): Do not call verify_no_unreachable_blocks
> > instead assert when we reach a block without predecessor that is not
> > the entry block.
> >
> > diff --git a/gcc/cfganal.c b/gcc/cfganal.c
> > index 3b80758e8f2..baf9f0562f9 100644
> > --- a/gcc/cfganal.c
> > +++ b/gcc/cfganal.c
> > @@ -186,18 +186,6 @@ find_unreachable_blocks (void)
> > free (worklist);
> > }
> >
> > -/* Verify that there are no unreachable blocks in the current function. */
> > -
> > -void
> > -verify_no_unreachable_blocks (void)
> > -{
> > - find_unreachable_blocks ();
> > -
> > - basic_block bb;
> > - FOR_EACH_BB_FN (bb, cfun)
> > - gcc_assert ((bb->flags & BB_REACHABLE) != 0);
> > -}
> > -
> > \f
> > /* Functions to access an edge list with a vector representation.
> > Enough data is kept such that given an index number, the
> > @@ -800,9 +788,6 @@ inverted_post_order_compute (vec<int> *post_order,
> > basic_block bb;
> > post_order->reserve_exact (n_basic_blocks_for_fn (cfun));
> >
> > - if (flag_checking)
> > - verify_no_unreachable_blocks ();
> > -
> > /* Allocate stack for back-tracking up CFG. */
> > auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (cfun) + 1);
> >
> > @@ -866,7 +851,10 @@ inverted_post_order_compute (vec<int> *post_order,
> > time, check its predecessors. */
> > stack.quick_push (ei_start (pred->preds));
> > else
> > - post_order->quick_push (pred->index);
> > + {
> > + gcc_assert (pred->index == ENTRY_BLOCK);
> > + post_order->quick_push (pred->index);
> > + }
> > }
> > else
> > {
> > diff --git a/gcc/cfganal.h b/gcc/cfganal.h
> > index 122c665f7f6..ac3fe8f4617 100644
> > --- a/gcc/cfganal.h
> > +++ b/gcc/cfganal.h
> > @@ -50,7 +50,6 @@ private:
> >
> > extern bool mark_dfs_back_edges (void);
> > extern void find_unreachable_blocks (void);
> > -extern void verify_no_unreachable_blocks (void);
> > struct edge_list * create_edge_list (void);
> > void free_edge_list (struct edge_list *);
> > void print_edge_list (FILE *, struct edge_list *);
> >
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
next prev parent reply other threads:[~2018-08-23 12:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 11:18 Richard Biener
2018-08-23 11:36 ` Steven Bosscher
2018-08-23 11:43 ` Richard Biener
2018-08-23 11:46 ` Tom de Vries
2018-08-23 12:06 ` Richard Biener [this message]
2018-08-23 13:29 ` Tom de Vries
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=alpine.LSU.2.20.1808231359450.16707@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=tdevries@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).