public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] move unreachable user labels to entry point
Date: Mon, 28 Jun 2021 15:42:38 +0000 (GMT)	[thread overview]
Message-ID: <20210628154238.4D5F6398796E@sourceware.org> (raw)

https://gcc.gnu.org/g:81d24842ddfd1e13a8f5b86357370296f2b659d2

commit 81d24842ddfd1e13a8f5b86357370296f2b659d2
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jun 28 12:40:32 2021 -0300

    move unreachable user labels to entry point

Diff:
---
 gcc/tree-cfg.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1f0f4a2c6eb..f6f005f10a9 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2300,13 +2300,11 @@ remove_bb (basic_block bb)
 		  FORCED_LABEL (gimple_label_label (label_stmt)) = 1;
 		}
 
-	      new_bb = bb->prev_bb;
-	      /* Don't move any labels into ENTRY block.  */
-	      if (new_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-		{
-		  new_bb = single_succ (new_bb);
-		  gcc_assert (new_bb != bb);
-		}
+	      /* We have to move the unreachable label somewhere.
+		 Moving it to the entry block makes sure it's moved at
+		 most once, and avoids messing with anonymous landing
+		 pad labels.  */
+	      new_bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
 	      if ((unsigned) bb->index < bb_to_omp_idx.length ()
 		  && ((unsigned) new_bb->index >= bb_to_omp_idx.length ()
 		      || (bb_to_omp_idx[bb->index]
@@ -2316,7 +2314,6 @@ remove_bb (basic_block bb)
 		     into the right OMP region.  */
 		  unsigned int i;
 		  int idx;
-		  new_bb = NULL;
 		  FOR_EACH_VEC_ELT (bb_to_omp_idx, i, idx)
 		    if (i >= NUM_FIXED_BLOCKS
 			&& idx == bb_to_omp_idx[bb->index]
@@ -2325,11 +2322,6 @@ remove_bb (basic_block bb)
 			new_bb = BASIC_BLOCK_FOR_FN (cfun, i);
 			break;
 		      }
-		  if (new_bb == NULL)
-		    {
-		      new_bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
-		      gcc_assert (new_bb != bb);
-		    }
 		}
 	      new_gsi = gsi_after_labels (new_bb);
 	      gsi_remove (&i, false);


             reply	other threads:[~2021-06-28 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 15:42 Alexandre Oliva [this message]
2021-07-10  0:08 Alexandre Oliva
2021-07-10  9:43 Alexandre Oliva

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=20210628154238.4D5F6398796E@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).