From 7a174a15342156271f6c01d9db6314f21b4f2935 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 20 Jan 2003 21:04:34 -0800 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/ifcvt.c | 3 ++- .../gcc.c-torture/execute/20030120-2.c | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030120-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 294e1065cb5..122cf2e037e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-01-20 Richard Henderson + + 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 * config/h8300/h8300.c (const_costs): Remove a warning. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 6b069af265d..341e7559823 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 00000000000..298bc4f5b4f --- /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; +}