aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2000-05-04 16:22:26 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-05-04 16:22:26 -0700
commit0927ce96c9f030dc7676ab4defbcd7e3f0ef61bf (patch)
tree595dfafa27d306f4217c2dd9bae5848f058a3aff /gcc
parent00447f7d40ea8099cd30d99fb62b290e990665fa (diff)
downloadgcc-0927ce96c9f030dc7676ab4defbcd7e3f0ef61bf.zip
gcc-0927ce96c9f030dc7676ab4defbcd7e3f0ef61bf.tar.gz
gcc-0927ce96c9f030dc7676ab4defbcd7e3f0ef61bf.tar.bz2
ifcvt.c (noce_process_if_block): Fail if A or B modified between condition and jump.
* ifcvt.c (noce_process_if_block): Fail if A or B modified between condition and jump. From-SVN: r33689
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ifcvt.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 7595fcb..79be885 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1054,11 +1054,6 @@ noce_process_if_block (test_bb, then_bb, else_bb, join_bb)
x = SET_DEST (set_a);
a = SET_SRC (set_a);
- /* X may not be mentioned between cond_earliest and the jump. */
- for (insn = jump; insn != if_info.cond_earliest; insn = PREV_INSN (insn))
- if (INSN_P (insn) && reg_mentioned_p (x, insn))
- return FALSE;
-
/* Look for the other potential set. Make sure we've got equivalent
destinations. */
/* ??? This is overconservative. Storing to two different mems is
@@ -1088,6 +1083,17 @@ noce_process_if_block (test_bb, then_bb, else_bb, join_bb)
}
b = (set_b ? SET_SRC (set_b) : x);
+ /* X may not be mentioned in the range (cond_earliest, jump]. */
+ for (insn = jump; insn != if_info.cond_earliest; insn = PREV_INSN (insn))
+ if (INSN_P (insn) && reg_mentioned_p (x, insn))
+ return FALSE;
+
+ /* A and B may not be modified in the range [cond_earliest, jump). */
+ for (insn = if_info.cond_earliest; insn != jump; insn = NEXT_INSN (insn))
+ if (INSN_P (insn)
+ && (modified_in_p (a, insn) || modified_in_p (b, insn)))
+ return FALSE;
+
/* Only operate on register destinations, and even then avoid extending
the lifetime of hard registers on small register class machines. */
orig_x = x;