Commit fdf0b018 by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

re PR rtl-optimization/45792 (cris-elf build failure (hangs) due to fix for PR44374)

	PR rtl-optimization/45792
	* cfgcleanup.c (try_head_merge_bb): New rtx vector nextptr.
	If not all insns are to be merged, for each edge, stash the
	next candidate after the to-be-merged insns before doing the
	merge, and use them for the retry at the new insertion point.
	Handle CC0 targets when retrying.

Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>

From-SVN: r164663
parent 7458026b
2010-09-27 Hans-Peter Nilsson <hp@axis.com>
Bernd Schmidt <bernds@codesourcery.com>
PR rtl-optimization/45792
* cfgcleanup.c (try_head_merge_bb): New rtx vector nextptr.
If not all insns are to be merged, for each edge, stash the
next candidate after the to-be-merged insns before doing the
merge, and use them for the retry at the new insertion point.
Handle CC0 targets when retrying.
2010-09-27 Ian Lance Taylor <iant@google.com> 2010-09-27 Ian Lance Taylor <iant@google.com>
* common.opt (fsplit-stack): New option. * common.opt (fsplit-stack): New option.
...@@ -1944,7 +1944,7 @@ try_head_merge_bb (basic_block bb) ...@@ -1944,7 +1944,7 @@ try_head_merge_bb (basic_block bb)
basic_block final_dest_bb = NULL; basic_block final_dest_bb = NULL;
int max_match = INT_MAX; int max_match = INT_MAX;
edge e0; edge e0;
rtx *headptr, *currptr; rtx *headptr, *currptr, *nextptr;
bool changed, moveall; bool changed, moveall;
unsigned ix; unsigned ix;
rtx e0_last_head, cond, move_before; rtx e0_last_head, cond, move_before;
...@@ -2077,6 +2077,7 @@ try_head_merge_bb (basic_block bb) ...@@ -2077,6 +2077,7 @@ try_head_merge_bb (basic_block bb)
currptr = XNEWVEC (rtx, nedges); currptr = XNEWVEC (rtx, nedges);
headptr = XNEWVEC (rtx, nedges); headptr = XNEWVEC (rtx, nedges);
nextptr = XNEWVEC (rtx, nedges);
for (ix = 0; ix < nedges; ix++) for (ix = 0; ix < nedges; ix++)
{ {
...@@ -2132,6 +2133,14 @@ try_head_merge_bb (basic_block bb) ...@@ -2132,6 +2133,14 @@ try_head_merge_bb (basic_block bb)
/* Try again, using a different insertion point. */ /* Try again, using a different insertion point. */
move_before = jump; move_before = jump;
#ifdef HAVE_cc0
/* Don't try moving before a cc0 user, as that may invalidate
the cc0. */
if (reg_mentioned_p (cc0_rtx, jump))
break;
#endif
continue; continue;
} }
...@@ -2155,6 +2164,18 @@ try_head_merge_bb (basic_block bb) ...@@ -2155,6 +2164,18 @@ try_head_merge_bb (basic_block bb)
} }
} }
/* If we can't currently move all of the identical insns, remember
each insn after the range that we'll merge. */
if (!moveall)
for (ix = 0; ix < nedges; ix++)
{
rtx curr = currptr[ix];
do
curr = NEXT_INSN (curr);
while (!NONDEBUG_INSN_P (curr));
nextptr[ix] = curr;
}
reorder_insns (headptr[0], currptr[0], PREV_INSN (move_before)); reorder_insns (headptr[0], currptr[0], PREV_INSN (move_before));
df_set_bb_dirty (EDGE_SUCC (bb, 0)->dest); df_set_bb_dirty (EDGE_SUCC (bb, 0)->dest);
if (final_dest_bb != NULL) if (final_dest_bb != NULL)
...@@ -2170,16 +2191,18 @@ try_head_merge_bb (basic_block bb) ...@@ -2170,16 +2191,18 @@ try_head_merge_bb (basic_block bb)
if (jump == move_before) if (jump == move_before)
break; break;
/* Try again, using a different insertion point. */ /* For the unmerged insns, try a different insertion point. */
move_before = jump; move_before = jump;
#ifdef HAVE_cc0
/* Don't try moving before a cc0 user, as that may invalidate
the cc0. */
if (reg_mentioned_p (cc0_rtx, jump))
break;
#endif
for (ix = 0; ix < nedges; ix++) for (ix = 0; ix < nedges; ix++)
{ currptr[ix] = headptr[ix] = nextptr[ix];
rtx curr = currptr[ix];
do
curr = NEXT_INSN (curr);
while (!NONDEBUG_INSN_P (curr));
currptr[ix] = headptr[ix] = curr;
}
} }
} }
while (!moveall); while (!moveall);
...@@ -2187,6 +2210,7 @@ try_head_merge_bb (basic_block bb) ...@@ -2187,6 +2210,7 @@ try_head_merge_bb (basic_block bb)
out: out:
free (currptr); free (currptr);
free (headptr); free (headptr);
free (nextptr);
crossjumps_occured |= changed; crossjumps_occured |= changed;
......
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