diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-01-07 08:54:47 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-01-07 08:54:47 +0100 |
commit | a0cbe71e87398b958cc88f5e3a7529cb9e1fd137 (patch) | |
tree | 9eaf6483aea9b5e5509844108efd82f4c23d2465 /gcc | |
parent | 41626746d0bd5aaff66a5489e80781917be881da (diff) | |
download | gcc-a0cbe71e87398b958cc88f5e3a7529cb9e1fd137.zip gcc-a0cbe71e87398b958cc88f5e3a7529cb9e1fd137.tar.gz gcc-a0cbe71e87398b958cc88f5e3a7529cb9e1fd137.tar.bz2 |
re PR rtl-optimization/58668 (internal compiler error: in cond_exec_process_insns, at ifcvt.c:339)
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.
From-SVN: r206385
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cfgcleanup.c | 24 | ||||
-rw-r--r-- | gcc/ifcvt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr58668.c | 25 |
5 files changed, 50 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4760b12..d7c3967 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2014-01-07 Jakub Jelinek <jakub@redhat.com> + 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. + PR tree-optimization/59643 * tree-predcom.c (split_data_refs_to_components): If one dr is read and one write, determine_offset fails and the write isn't diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index e2e407b..028f828 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); } diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 3984535..aaed2d0 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -118,7 +118,7 @@ count_bb_insns (const_basic_block bb) while (1) { - if (CALL_P (insn) || NONJUMP_INSN_P (insn)) + if (active_insn_p (insn) && !JUMP_P (insn)) count++; if (insn == BB_END (bb)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 629d420..1ad3731 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2014-01-07 Jakub Jelinek <jakub@redhat.com> + PR rtl-optimization/58668 + * gcc.dg/pr58668.c: New test. + PR tree-optimization/59643 * gcc.dg/pr59643.c: New test. * gcc.c-torture/execute/pr59643.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr58668.c b/gcc/testsuite/gcc.dg/pr58668.c new file mode 100644 index 0000000..3e09508 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58668.c @@ -0,0 +1,25 @@ +/* PR rtl-optimization/58668 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-mthumb" { target { { arm*-*-* } && arm_thumb2_ok } } } */ + +void *fn1 (void *); +void *fn2 (void *, const char *); +void fn3 (void *); +void fn4 (void *, int); + +void * +test (void *x) +{ + void *a, *b; + if (!(a = fn1 (x))) + return (void *) 0; + if (!(b = fn2 (a, "w"))) + { + fn3 (a); + return (void *) 0; + } + fn3 (a); + fn4 (b, 1); + return b; +} |