summaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-07 07:54:47 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-07 07:54:47 +0000
commit177a616b3b34ffb9e0d71acbfe205ebaff1b0ade (patch)
tree9eaf6483aea9b5e5509844108efd82f4c23d2465 /gcc/cfgcleanup.c
parent19f2ced25388221aa16d202534fddd38e9efe8ab (diff)
downloadgcc-177a616b3b34ffb9e0d71acbfe205ebaff1b0ade.tar.gz
PR rtl-optimization/58668
* cfgcleanup.c (flow_find_cross_jump): Don't count any jumps if dir_p is NULL. Remove p1 variable, use active_insn_p to determine what is counted. (flow_find_head_matching_sequence): Use active_insn_p to determine what is counted. (try_head_merge_bb): Adjust for the flow_find_head_matching_sequence counting change. * ifcvt.c (count_bb_insns): Use active_insn_p && !JUMP_P to determine what is counted. * gcc.dg/pr58668.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206385 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index e2e407bd2de..028f8288662 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1295,7 +1295,6 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2,
{
rtx i1, i2, last1, last2, afterlast1, afterlast2;
int ninsns = 0;
- rtx p1;
enum replace_direction dir, last_dir, afterlast_dir;
bool follow_fallthru, did_fallthru;
@@ -1323,8 +1322,9 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2,
|| (returnjump_p (i2) && !side_effects_p (PATTERN (i2))))
{
last2 = i2;
- /* Count everything except for unconditional jump as insn. */
- if (!simplejump_p (i2) && !returnjump_p (i2) && last1)
+ /* Count everything except for unconditional jump as insn.
+ Don't count any jumps if dir_p is NULL. */
+ if (!simplejump_p (i2) && !returnjump_p (i2) && last1 && dir_p)
ninsns++;
i2 = PREV_INSN (i2);
}
@@ -1375,8 +1375,7 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2,
last1 = i1, last2 = i2;
afterlast_dir = last_dir;
last_dir = dir;
- p1 = PATTERN (i1);
- if (!(GET_CODE (p1) == USE || GET_CODE (p1) == CLOBBER))
+ if (active_insn_p (i1))
ninsns++;
}
@@ -1494,7 +1493,8 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1,
beforelast1 = last1, beforelast2 = last2;
last1 = i1, last2 = i2;
- ninsns++;
+ if (active_insn_p (i1))
+ ninsns++;
}
if (i1 == BB_END (bb1) || i2 == BB_END (bb2)
@@ -2408,9 +2408,7 @@ try_head_merge_bb (basic_block bb)
max_match--;
if (max_match == 0)
return false;
- do
- e0_last_head = prev_real_insn (e0_last_head);
- while (DEBUG_INSN_P (e0_last_head));
+ e0_last_head = prev_active_insn (e0_last_head);
}
if (max_match == 0)
@@ -2430,16 +2428,14 @@ try_head_merge_bb (basic_block bb)
basic_block merge_bb = EDGE_SUCC (bb, ix)->dest;
rtx head = BB_HEAD (merge_bb);
- while (!NONDEBUG_INSN_P (head))
- head = NEXT_INSN (head);
+ if (!active_insn_p (head))
+ head = next_active_insn (head);
headptr[ix] = head;
currptr[ix] = head;
/* Compute the end point and live information */
for (j = 1; j < max_match; j++)
- do
- head = NEXT_INSN (head);
- while (!NONDEBUG_INSN_P (head));
+ head = next_active_insn (head);
simulate_backwards_to_point (merge_bb, live, head);
IOR_REG_SET (live_union, live);
}