Commit b59e0455 by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/59724 (ICE : in rtl_verify_bb_layout, at cfgrtl.c)

	PR rtl-optimization/59724
	* ifcvt.c (cond_exec_process_if_block): Don't call
	flow_find_head_matching_sequence with 0 longest_match.
	* cfgcleanup.c (flow_find_head_matching_sequence): Count even
	non-active insns if !stop_after.
	(try_head_merge_bb): Revert 2014-01-07 changes.

From-SVN: r206456
parent 650c4c85
2014-01-09 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/59724
* ifcvt.c (cond_exec_process_if_block): Don't call
flow_find_head_matching_sequence with 0 longest_match.
* cfgcleanup.c (flow_find_head_matching_sequence): Count even
non-active insns if !stop_after.
(try_head_merge_bb): Revert 2014-01-07 changes.
2014-01-08 Jeff Law <law@redhat.com> 2014-01-08 Jeff Law <law@redhat.com>
* ree.c (get_sub_rtx): New function, extracted from... * ree.c (get_sub_rtx): New function, extracted from...
......
...@@ -1421,7 +1421,8 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2, ...@@ -1421,7 +1421,8 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2,
/* Like flow_find_cross_jump, except start looking for a matching sequence from /* Like flow_find_cross_jump, except start looking for a matching sequence from
the head of the two blocks. Do not include jumps at the end. the head of the two blocks. Do not include jumps at the end.
If STOP_AFTER is nonzero, stop after finding that many matching If STOP_AFTER is nonzero, stop after finding that many matching
instructions. */ instructions. If STOP_AFTER is zero, count all INSN_P insns, if it is
non-zero, only count active insns. */
int int
flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1, flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1,
...@@ -1493,7 +1494,7 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1, ...@@ -1493,7 +1494,7 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1,
beforelast1 = last1, beforelast2 = last2; beforelast1 = last1, beforelast2 = last2;
last1 = i1, last2 = i2; last1 = i1, last2 = i2;
if (active_insn_p (i1)) if (!stop_after || active_insn_p (i1))
ninsns++; ninsns++;
} }
...@@ -2408,7 +2409,9 @@ try_head_merge_bb (basic_block bb) ...@@ -2408,7 +2409,9 @@ try_head_merge_bb (basic_block bb)
max_match--; max_match--;
if (max_match == 0) if (max_match == 0)
return false; return false;
e0_last_head = prev_active_insn (e0_last_head); do
e0_last_head = prev_real_insn (e0_last_head);
while (DEBUG_INSN_P (e0_last_head));
} }
if (max_match == 0) if (max_match == 0)
...@@ -2428,14 +2431,16 @@ try_head_merge_bb (basic_block bb) ...@@ -2428,14 +2431,16 @@ try_head_merge_bb (basic_block bb)
basic_block merge_bb = EDGE_SUCC (bb, ix)->dest; basic_block merge_bb = EDGE_SUCC (bb, ix)->dest;
rtx head = BB_HEAD (merge_bb); rtx head = BB_HEAD (merge_bb);
if (!active_insn_p (head)) while (!NONDEBUG_INSN_P (head))
head = next_active_insn (head); head = NEXT_INSN (head);
headptr[ix] = head; headptr[ix] = head;
currptr[ix] = head; currptr[ix] = head;
/* Compute the end point and live information */ /* Compute the end point and live information */
for (j = 1; j < max_match; j++) for (j = 1; j < max_match; j++)
head = next_active_insn (head); do
head = NEXT_INSN (head);
while (!NONDEBUG_INSN_P (head));
simulate_backwards_to_point (merge_bb, live, head); simulate_backwards_to_point (merge_bb, live, head);
IOR_REG_SET (live_union, live); IOR_REG_SET (live_union, live);
} }
......
...@@ -522,7 +522,10 @@ cond_exec_process_if_block (ce_if_block * ce_info, ...@@ -522,7 +522,10 @@ cond_exec_process_if_block (ce_if_block * ce_info,
n_insns -= 2 * n_matching; n_insns -= 2 * n_matching;
} }
if (then_start && else_start) if (then_start
&& else_start
&& then_n_insns > n_matching
&& else_n_insns > n_matching)
{ {
int longest_match = MIN (then_n_insns - n_matching, int longest_match = MIN (then_n_insns - n_matching,
else_n_insns - n_matching); else_n_insns - n_matching);
......
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