]> gcc.gnu.org Git - gcc.git/commitdiff
cfg.c (redirect_edge_succ_nodup): Duplicate the varm map before removing the edge.
authorJeff Law <law@redhat.com>
Wed, 23 Mar 2011 17:35:59 +0000 (11:35 -0600)
committerJeff Law <law@gcc.gnu.org>
Wed, 23 Mar 2011 17:35:59 +0000 (11:35 -0600)
* cfg.c (redirect_edge_succ_nodup): Duplicate the varm map
before removing the edge.

* cfgrtl.c (cfg_layout_redirect_edge_and_branch): Do not use E after
it may have been freed by redirect_branch_edge or
redirect_edge_succ_nodup.

From-SVN: r171356

gcc/ChangeLog
gcc/cfg.c
gcc/cfgrtl.c

index 1591ce89ce3c2d25b6070cbc4d34d8c39ef843ba..436be3acc48e4eb09652fa2d5efdd4f3a43646d9 100644 (file)
@@ -1,3 +1,12 @@
+2011-03-23  Jeff Law  <law@redhat.com>
+
+       * cfg.c (redirect_edge_succ_nodup): Duplicate the varm map
+       before removing the edge.
+
+       * cfgrtl.c (cfg_layout_redirect_edge_and_branch): Do not use E after
+       it may have been freed by redirect_branch_edge or
+       redirect_edge_succ_nodup.
+
 2011-03-23  Richard Guenther  <rguenther@suse.de>
 
        * tree-stdarg.c (va_list_counter_bump): Handle bumps via
index c8ef799148e8c48050767198cd5d26d7b9e3c0ad..5b1dc2649f1feb8591c171a3d2582825d9d0b91d 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -402,8 +402,8 @@ redirect_edge_succ_nodup (edge e, basic_block new_succ)
       if (s->probability > REG_BR_PROB_BASE)
        s->probability = REG_BR_PROB_BASE;
       s->count += e->count;
-      remove_edge (e);
       redirect_edge_var_map_dup (s, e);
+      remove_edge (e);
       e = s;
     }
   else
index 5d64f3af0190663dad95160a5727336c5006918d..e78f5baf6ba8a3749a47dfe0f96f67e48860c036 100644 (file)
@@ -2537,9 +2537,9 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
          e->flags &= ~EDGE_FALLTHRU;
          redirected = redirect_branch_edge (e, dest);
          gcc_assert (redirected);
-         e->flags |= EDGE_FALLTHRU;
-         df_set_bb_dirty (e->src);
-         return e;
+         redirected->flags |= EDGE_FALLTHRU;
+         df_set_bb_dirty (redirected->src);
+         return redirected;
        }
       /* In case we are redirecting fallthru edge to the branch edge
         of conditional jump, remove it.  */
@@ -2553,10 +2553,10 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
              && onlyjump_p (BB_END (src)))
            delete_insn (BB_END (src));
        }
-      ret = redirect_edge_succ_nodup (e, dest);
       if (dump_file)
        fprintf (dump_file, "Fallthru edge %i->%i redirected to %i\n",
                 e->src->index, e->dest->index, dest->index);
+      ret = redirect_edge_succ_nodup (e, dest);
     }
   else
     ret = redirect_branch_edge (e, dest);
This page took 0.084796 seconds and 5 git commands to generate.