https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117665

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index d16ad6a28de..ee089ee67cc 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -5417,6 +5417,7 @@ static void
 fold_marked_statements (int first, hash_set<gimple *> *statements)
 {
   auto_bitmap to_purge;
+  auto_bitmap to_purge_abnormal;

   auto_vec<edge, 20> stack (n_basic_blocks_for_fn (cfun) + 2);
   auto_sbitmap visited (last_basic_block_for_fn (cfun));
@@ -5488,6 +5489,9 @@ fold_marked_statements (int first, hash_set<gimple *>
*statements)
                            if (maybe_clean_or_replace_eh_stmt (old_stmt,
                                                                new_stmt))
                              bitmap_set_bit (to_purge, dest->index);
+                           if (*gsi_last_bb (dest) == new_stmt
+                               && !stmt_can_make_abnormal_goto (new_stmt))
+                             bitmap_set_bit (to_purge_abnormal, dest->index);
                            break;
                          }
                        gsi_next (&i2);
@@ -5508,6 +5512,9 @@ fold_marked_statements (int first, hash_set<gimple *>
*statements)

                if (maybe_clean_or_replace_eh_stmt (old_stmt, new_stmt))
                  bitmap_set_bit (to_purge, dest->index);
+               if (*gsi_last_bb (dest) == new_stmt
+                   && !stmt_can_make_abnormal_goto (new_stmt))
+                 bitmap_set_bit (to_purge_abnormal, dest->index);
              }
          }

@@ -5529,6 +5536,7 @@ fold_marked_statements (int first, hash_set<gimple *>
*statements)
     }

   gimple_purge_all_dead_eh_edges (to_purge);
+  gimple_purge_all_dead_abnormal_call_edges (to_purge_abnormal);
 }

 /* Expand calls to inline functions in the body of FN.  */

Reply via email to