function.c (thread_prologue_and_epilogue_insns): Build a vector of unconverted simple...
authorBernd Schmidt <bernds@codesourcery.com>
Thu, 6 Oct 2011 15:59:53 +0000 (15:59 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Thu, 6 Oct 2011 15:59:53 +0000 (15:59 +0000)
* function.c (thread_prologue_and_epilogue_insns): Build a vector
of unconverted simple return blocks rather than trying to
recompute them later based on bb_flags bitmap tests.

From-SVN: r179619

gcc/ChangeLog
gcc/function.c

index 461683783f5ffaaa161897fdcd0db2afc7c15c8f..ae8c6c94e6eaaae3900c7afe58b8f543dc8eee04 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-06  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * function.c (thread_prologue_and_epilogue_insns): Build a vector
+       of unconverted simple return blocks rather than trying to
+       recompute them later based on bb_flags bitmap tests.
+
 2011-10-06  Michael Matz  <matz@suse.de>
 
        * tree-flow.h (get_var_ann): Don't declare.
index d13e9282dfb4e6890848f31d065d1c30753ecad7..c535ff04d10e0d517664b3dbfa40bf62d1c9b229 100644 (file)
@@ -5455,7 +5455,7 @@ thread_prologue_and_epilogue_insns (void)
   basic_block last_bb;
   bool last_bb_active ATTRIBUTE_UNUSED;
 #ifdef HAVE_simple_return
-  bool unconverted_simple_returns = false;
+  VEC (basic_block, heap) *unconverted_simple_returns = NULL;
   basic_block simple_return_block_hot = NULL;
   basic_block simple_return_block_cold = NULL;
   bool nonempty_prologue;
@@ -5876,7 +5876,8 @@ thread_prologue_and_epilogue_insns (void)
                {
 #ifdef HAVE_simple_return
                  if (simple_p)
-                   unconverted_simple_returns = true;
+                   VEC_safe_push (basic_block, heap,
+                                  unconverted_simple_returns, bb);
 #endif
                  continue;
                }
@@ -5894,7 +5895,8 @@ thread_prologue_and_epilogue_insns (void)
            {
 #ifdef HAVE_simple_return
              if (simple_p)
-               unconverted_simple_returns = true;
+               VEC_safe_push (basic_block, heap,
+                              unconverted_simple_returns, bb);
 #endif
              continue;
            }
@@ -6042,10 +6044,11 @@ epilogue_done:
      convert to conditional simple_returns, but couldn't for some
      reason, create a block to hold a simple_return insn and redirect
      those remaining edges.  */
-  if (unconverted_simple_returns)
+  if (!VEC_empty (basic_block, unconverted_simple_returns))
     {
-      edge_iterator ei2;
       basic_block exit_pred = EXIT_BLOCK_PTR->prev_bb;
+      basic_block src_bb;
+      int i;
 
       gcc_assert (entry_edge != orig_entry_edge);
 
@@ -6062,19 +6065,12 @@ epilogue_done:
            simple_return_block_cold = e->dest;
        }
 
-    restart_scan:
-      for (ei2 = ei_start (last_bb->preds); (e = ei_safe_edge (ei2)); )
+      FOR_EACH_VEC_ELT (basic_block, unconverted_simple_returns, i, src_bb)
        {
-         basic_block bb = e->src;
+         edge e = find_edge (src_bb, last_bb);
          basic_block *pdest_bb;
 
-         if (bb == ENTRY_BLOCK_PTR
-             || bitmap_bit_p (&bb_flags, bb->index))
-           {
-             ei_next (&ei2);
-             continue;
-           }
-         if (BB_PARTITION (e->src) == BB_HOT_PARTITION)
+         if (BB_PARTITION (src_bb) == BB_HOT_PARTITION)
            pdest_bb = &simple_return_block_hot;
          else
            pdest_bb = &simple_return_block_cold;
@@ -6094,8 +6090,8 @@ epilogue_done:
              make_edge (bb, EXIT_BLOCK_PTR, 0);
            }
          redirect_edge_and_branch_force (e, *pdest_bb);
-         goto restart_scan;
        }
+      VEC_free (basic_block, heap, unconverted_simple_returns);
     }
 #endif