re PR rtl-optimization/8848 (bad code when optimizing (lifetime analysis pass?))
authorRichard Henderson <rth@redhat.com>
Tue, 21 Jan 2003 05:04:34 +0000 (21:04 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 21 Jan 2003 05:04:34 +0000 (21:04 -0800)
        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

gcc/ChangeLog
gcc/ifcvt.c
gcc/testsuite/gcc.c-torture/execute/20030120-2.c [new file with mode: 0644]

index 294e1065cb562e657d0da291501f373a9368d6ef..122cf2e037e5e447a60a478bfeba678923fbb1ea 100644 (file)
@@ -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.
index 6b069af265d316471caf83af4e24c6247623e854..341e755982399df5ff4de1db10bc2f916a727aae 100644 (file)
@@ -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 (file)
index 0000000..298bc4f
--- /dev/null
@@ -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;
+}