Commit f0bc3cc0 by Jeff Law Committed by Jeff Law

tree-ssa-threadupdate.h (delete_thread_path): Declare.

       * tree-ssa-threadupdate.h (delete_thread_path): Declare.
        * tree-ssa-threadupdate.c (delete_thread_path): New function.
        (ssa_redirect_edges, thread_block_1): Use it.
        (thread_through_loop_header, mark_threaded_blocks): Likewise.
        (thread_through_all_blocks, register_jump_thread): Likewise.
        * tree-ssa-threadedge.c (thread_across_edge): Likewise.

From-SVN: r204579
parent df023e0f
2013-11-08 Jeff Law <law@redhat.com>
* tree-ssa-threadupdate.h (delete_thread_path): Declare.
* tree-ssa-threadupdate.c (delete_thread_path): New function.
(ssa_redirect_edges, thread_block_1): Use it.
(thread_through_loop_header, mark_threaded_blocks): Likewise.
(thread_through_all_blocks, register_jump_thread): Likewise.
* tree-ssa-threadedge.c (thread_across_edge): Likewise.
2013-11-08 James Greenhalgh <james.greenhalgh@arm.com> 2013-11-08 James Greenhalgh <james.greenhalgh@arm.com>
* config/arm/aarch-common.c * config/arm/aarch-common.c
...@@ -1086,9 +1086,7 @@ thread_across_edge (gimple dummy_cond, ...@@ -1086,9 +1086,7 @@ thread_across_edge (gimple dummy_cond,
} }
else else
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release();
} }
} }
BITMAP_FREE (visited); BITMAP_FREE (visited);
......
...@@ -555,9 +555,7 @@ ssa_redirect_edges (struct redirection_data **slot, ...@@ -555,9 +555,7 @@ ssa_redirect_edges (struct redirection_data **slot,
/* Go ahead and clear E->aux. It's not needed anymore and failure /* Go ahead and clear E->aux. It's not needed anymore and failure
to clear it will cause all kinds of unpleasant problems later. */ to clear it will cause all kinds of unpleasant problems later. */
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
...@@ -703,9 +701,7 @@ thread_block_1 (basic_block bb, bool noloop_only, bool joiners) ...@@ -703,9 +701,7 @@ thread_block_1 (basic_block bb, bool noloop_only, bool joiners)
/* Since this case is not handled by our special code /* Since this case is not handled by our special code
to thread through a loop header, we must explicitly to thread through a loop header, we must explicitly
cancel the threading request here. */ cancel the threading request here. */
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
continue; continue;
} }
...@@ -1161,9 +1157,7 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers) ...@@ -1161,9 +1157,7 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers)
if (e->src->loop_father != e2->dest->loop_father if (e->src->loop_father != e2->dest->loop_father
&& e2->dest != loop->header) && e2->dest != loop->header)
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
} }
...@@ -1213,9 +1207,7 @@ fail: ...@@ -1213,9 +1207,7 @@ fail:
if (path) if (path)
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
} }
...@@ -1310,9 +1302,7 @@ mark_threaded_blocks (bitmap threaded_blocks) ...@@ -1310,9 +1302,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
if (e2 && !phi_args_equal_on_edges (e2, final_edge)) if (e2 && !phi_args_equal_on_edges (e2, final_edge))
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
} }
...@@ -1336,9 +1326,7 @@ mark_threaded_blocks (bitmap threaded_blocks) ...@@ -1336,9 +1326,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
if (e->aux) if (e->aux)
{ {
vec<jump_thread_edge *> *path = THREAD_PATH (e); vec<jump_thread_edge *> *path = THREAD_PATH (e);
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
} }
...@@ -1395,9 +1383,7 @@ mark_threaded_blocks (bitmap threaded_blocks) ...@@ -1395,9 +1383,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
|| (path->last ()->type || (path->last ()->type
== EDGE_COPY_SRC_JOINER_BLOCK)) == EDGE_COPY_SRC_JOINER_BLOCK))
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
break; break;
...@@ -1498,9 +1484,7 @@ thread_through_all_blocks (bool may_peel_loop_headers) ...@@ -1498,9 +1484,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
{ {
vec<jump_thread_edge *> *path = THREAD_PATH (e); vec<jump_thread_edge *> *path = THREAD_PATH (e);
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
e->aux = NULL; e->aux = NULL;
} }
} }
...@@ -1520,6 +1504,17 @@ thread_through_all_blocks (bool may_peel_loop_headers) ...@@ -1520,6 +1504,17 @@ thread_through_all_blocks (bool may_peel_loop_headers)
return retval; return retval;
} }
/* Delete the jump threading path PATH. We have to explcitly delete
each entry in the vector, then the container. */
void
delete_jump_thread_path (vec<jump_thread_edge *> *path)
{
for (unsigned int i = 0; i < path->length (); i++)
delete (*path)[i];
path->release();
}
/* Dump a jump threading path, including annotations about each /* Dump a jump threading path, including annotations about each
edge in the path. */ edge in the path. */
...@@ -1565,9 +1560,7 @@ register_jump_thread (vec<jump_thread_edge *> *path) ...@@ -1565,9 +1560,7 @@ register_jump_thread (vec<jump_thread_edge *> *path)
{ {
if (!dbg_cnt (registered_jump_thread)) if (!dbg_cnt (registered_jump_thread))
{ {
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
return; return;
} }
...@@ -1583,9 +1576,7 @@ register_jump_thread (vec<jump_thread_edge *> *path) ...@@ -1583,9 +1576,7 @@ register_jump_thread (vec<jump_thread_edge *> *path)
dump_jump_thread_path (dump_file, *path); dump_jump_thread_path (dump_file, *path);
} }
for (unsigned int i = 0; i < path->length (); i++) delete_jump_thread_path (path);
delete (*path)[i];
path->release ();
return; return;
} }
......
...@@ -42,4 +42,5 @@ public: ...@@ -42,4 +42,5 @@ public:
}; };
extern void register_jump_thread (vec <class jump_thread_edge *> *); extern void register_jump_thread (vec <class jump_thread_edge *> *);
extern void delete_jump_thread_path (vec <class jump_thread_edge *> *);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment