public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] move unreachable user labels to entry point
@ 2021-07-10  9:43 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-07-10  9:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e15b2c5da846bf082957c4240ff386b8f8154728

commit e15b2c5da846bf082957c4240ff386b8f8154728
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Jul 9 19:54:44 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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] move unreachable user labels to entry point
@ 2021-07-10  0:08 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-07-10  0:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c377d31b12ff58322274d1ae321c8ae880bf74c6

commit c377d31b12ff58322274d1ae321c8ae880bf74c6
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Jul 9 19:54:44 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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] move unreachable user labels to entry point
@ 2021-06-28 15:42 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-06-28 15:42 UTC (permalink / raw)
  To: gcc-cvs

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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-10  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10  9:43 [gcc(refs/users/aoliva/heads/testme)] move unreachable user labels to entry point Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2021-07-10  0:08 Alexandre Oliva
2021-06-28 15:42 Alexandre Oliva

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).