aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-20 21:04:34 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-01-20 21:04:34 -0800
commit7a174a15342156271f6c01d9db6314f21b4f2935 (patch)
tree1cdf0032837ad715059d4304a7cebfa1985d8cb6
parent9ac7ebba1c097d331bac2b9b47811740030fa7be (diff)
downloadgcc-7a174a15342156271f6c01d9db6314f21b4f2935.zip
gcc-7a174a15342156271f6c01d9db6314f21b4f2935.tar.gz
gcc-7a174a15342156271f6c01d9db6314f21b4f2935.tar.bz2
re PR rtl-optimization/8848 (bad code when optimizing (lifetime analysis pass?))
PR opt/8848 * ifcvt.c (noce_process_if_block): Correct arguments to modified_between_p for no-else-block case. * gcc.c-torture/execute/20030120-2.c: New. From-SVN: r61532
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ifcvt.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030120-2.c19
3 files changed, 27 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 294e106..122cf2e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-20 Richard Henderson <rth@redhat.com>
+
+ PR opt/8848
+ * ifcvt.c (noce_process_if_block): Correct arguments to
+ modified_between_p for no-else-block case.
+
2003-01-20 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (const_costs): Remove a warning.
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 6b069af..341e755 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1809,7 +1809,8 @@ noce_process_if_block (ce_info)
|| reg_overlap_mentioned_p (x, cond)
|| reg_overlap_mentioned_p (x, a)
|| reg_overlap_mentioned_p (x, SET_SRC (set_b))
- || modified_between_p (x, if_info.cond_earliest, NEXT_INSN (jump)))
+ || modified_between_p (SET_SRC (set_b),
+ PREV_INSN (if_info.cond_earliest), jump))
insn_b = set_b = NULL_RTX;
}
b = (set_b ? SET_SRC (set_b) : x);
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030120-2.c b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c
new file mode 100644
index 0000000..298bc4f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c
@@ -0,0 +1,19 @@
+/* PR 8848 */
+
+extern void abort ();
+
+int foo(int status)
+{
+ int s = 0;
+ if (status == 1) s=1;
+ if (status == 3) s=3;
+ if (status == 4) s=4;
+ return s;
+}
+
+int main()
+{
+ if (foo (3) != 3)
+ abort ();
+ return 0;
+}