https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68117
--- Comment #27 from Richard Biener <rguenth at gcc dot gnu.org> ---
Sth like
Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c (revision 230404)
+++ gcc/tree-ssa.c (working copy)
@@ -125,6 +125,14 @@ redirect_edge_var_map_destroy (void)
edge_var_maps = NULL;
}
+/* Verify the edge_var_map is empty. */
+
+void
+check_redirect_edge_var_map_empty (void)
+{
+ gcc_assert (!edge_var_maps || edge_var_maps->elements () == 0);
+}
+
/* Remove the corresponding arguments from the PHI nodes in E's
destination block and redirect it to DEST. Return redirected edge.
Index: gcc/tree-ssa.h
===================================================================
--- gcc/tree-ssa.h (revision 230404)
+++ gcc/tree-ssa.h (working copy)
@@ -36,6 +36,7 @@ extern void redirect_edge_var_map_clear
extern void redirect_edge_var_map_dup (edge, edge);
extern vec<edge_var_map> *redirect_edge_var_map_vector (edge);
extern void redirect_edge_var_map_destroy (void);
+extern void check_redirect_edge_var_map_empty (void);
extern edge ssa_redirect_edge (edge, basic_block);
extern void flush_pending_stmts (edge);
extern void gimple_replace_ssa_lhs (gimple *, tree);
Index: gcc/passes.c
===================================================================
--- gcc/passes.c (revision 230404)
+++ gcc/passes.c (working copy)
@@ -2211,7 +2214,10 @@ execute_one_ipa_transform_pass (struct c
/* Signal this is a suitable GC collection point. */
if (!(todo_after & TODO_do_not_ggc_collect))
- ggc_collect ();
+ {
+ check_redirect_edge_var_map_empty ();
+ ggc_collect ();
+ }
}
/* For the current function, execute all ipa transforms. */
@@ -2380,7 +2386,10 @@ execute_one_pass (opt_pass *pass)
/* Signal this is a suitable GC collection point. */
if (!((todo_after | pass->todo_flags_finish) & TODO_do_not_ggc_collect))
- ggc_collect ();
+ {
+ check_redirect_edge_var_map_empty ();
+ ggc_collect ();
+ }
return true;
}
after all edge_var_maps is _not_ GTY marked.