From dfc4de0a4a9423f20143326387a74ac9bfb2a67e Mon Sep 17 00:00:00 2001 From: amylaar Date: Wed, 1 Jun 2005 11:38:53 +0000 Subject: [PATCH] PR rtl-optimization/21767 * rtl.h (function_invariant_p): Re-add declaration. * reload1.c (function_invariant_p): No longer static. * ifcvt.c (dead_or_predicable): Remove REG_EQUAL notes that might have become invalid. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100448 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/ifcvt.c | 19 +++++++++++++++++++ gcc/reload1.c | 3 +-- gcc/rtl.h | 3 +++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cc59298371..0c877904a09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-06-01 J"orn Rennecke + + PR rtl-optimization/21767 + * rtl.h (function_invariant_p): Re-add declaration. + * reload1.c (function_invariant_p): No longer static. + * ifcvt.c (dead_or_predicable): Remove REG_EQUAL notes that + might have become invalid. + 2005-06-01 Jakub Jelinek PR c/21536 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 5c822b64d95..d4b66a58f7a 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3430,12 +3430,31 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, /* Move the insns out of MERGE_BB to before the branch. */ if (head != NULL) { + rtx insn; + if (end == BB_END (merge_bb)) BB_END (merge_bb) = PREV_INSN (head); if (squeeze_notes (&head, &end)) return TRUE; + /* PR 21767: When moving insns above a conditional branch, REG_EQUAL + notes might become invalid. */ + insn = head; + do + { + rtx note, set; + + if (! INSN_P (insn)) + continue; + note = find_reg_note (insn, REG_EQUAL, NULL_RTX); + if (! note) + continue; + set = single_set (insn); + if (!set || !function_invariant_p (SET_SRC (set))) + remove_note (insn, note); + } while (insn != end && (insn = NEXT_INSN (insn))); + reorder_insns (head, end, PREV_INSN (earliest)); } diff --git a/gcc/reload1.c b/gcc/reload1.c index 6158af55726..0caa411fb4b 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -405,7 +405,6 @@ static int reload_reg_free_for_value_p (int, int, int, enum reload_type, rtx, rtx, int, int); static int free_for_value_p (int, enum machine_mode, int, enum reload_type, rtx, rtx, int, int); -static int function_invariant_p (rtx); static int reload_reg_reaches_end_p (unsigned int, int, enum reload_type); static int allocate_reload_reg (struct insn_chain *, int, int); static int conflicts_with_override (rtx); @@ -4984,7 +4983,7 @@ free_for_value_p (int regno, enum machine_mode mode, int opnum, pic_offset_table_rtx is not, and we must not spill these things to memory. */ -static int +int function_invariant_p (rtx x) { if (CONSTANT_P (x)) diff --git a/gcc/rtl.h b/gcc/rtl.h index 2eb5d9c84b8..69091ab36d0 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2062,6 +2062,9 @@ extern void dbr_schedule (rtx, FILE *); extern void dump_local_alloc (FILE *); extern int local_alloc (void); +/* In reload1.c */ +extern int function_invariant_p (rtx); + /* In reg-stack.c */ extern bool reg_to_stack (FILE *); -- 2.11.4.GIT