shrink-wrap: Handle multiple predecessors of prologue
The caller of try_shrink_wrapping wants to be returned a single edge to
put the prologue on. To make that work even if there are multiple edges
(all pointing to the PRO block) that need the prologue, add a new block
that becomes the destination of all such edges, and then jumps to PRO.
In the general case, some edges to PRO will need to be redirected, and
not all edges *can* be redirected. This adds a can_get_prologue function
that detects such cases. This then happily can also handle the "prologue
clobbers some reg that is live on the edge we want to insert it on" case.
Not all EDGE_CROSSING edges can be redirected, so handle those the same
as EDGE_COMPLEX edges.
2015-09-22 Segher Boessenkool <segher@kernel.crashing.org>
* function.c (thread_prologue_and_epilogue_insns): Delete
orig_entry_edge argument to try_shrink_wrapping.
* shrink-wrap.c (can_get_prologue): New function.
(can_dup_for_shrink_wrapping): Also handle EDGE_CROSSING.
(try_shrink_wrapping): Delete orig_entry_edge argument. Use
can_get_prologue where needed. Remove code that finds a single
edge for the prologue. Remove code that tests if any reg clobbered
by the prologue is live on the prologue edge. Remove code that finds
the new prologue edge after duplicating blocks. Make a new prologue
block and edge.
* shrink-wrap.h (try_shrink_wrapping): Delete orig_entry_edge argument.
From-SVN: r228022