From 2f39b6caf61637fe3656c1b63b316dc3af6f3028 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 28 Sep 2004 23:29:02 +0000 Subject: [PATCH] cse.c (cse_insn): Avoid creating direct non-local jumps. * cse.c (cse_insn): Avoid creating direct non-local jumps. * combine.c (can_combine_p): Likewise. * local-alloc. (update_equiv_regs): Likewise. From-SVN: r88258 --- gcc/ChangeLog | 6 ++++++ gcc/combine.c | 2 ++ gcc/cse.c | 5 +++++ gcc/local-alloc.c | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69229c2d13c..129c4088204 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-09-28 Ulrich Weigand + + * cse.c (cse_insn): Avoid creating direct non-local jumps. + * combine.c (can_combine_p): Likewise. + * local-alloc. (update_equiv_regs): Likewise. + 2004-09-28 Richard Henderson PR 17531 diff --git a/gcc/combine.c b/gcc/combine.c index ad5ec6483a3..2c7fbf5e74d 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1176,6 +1176,8 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ, /* Don't substitute into an incremented register. */ || FIND_REG_INC_NOTE (i3, dest) || (succ && FIND_REG_INC_NOTE (succ, dest)) + /* Don't substitute into a non-local goto, this confuses CFG. */ + || (JUMP_P (i3) && find_reg_note (i3, REG_NON_LOCAL_GOTO, NULL_RTX)) #if 0 /* Don't combine the end of a libcall into anything. */ /* ??? This gives worse code, and appears to be unnecessary, since no diff --git a/gcc/cse.c b/gcc/cse.c index ca577c5de6b..651203d1064 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -5395,6 +5395,11 @@ cse_insn (rtx insn, rtx libcall_insn) || (GET_CODE (trial) == LABEL_REF && ! condjump_p (insn)))) { + /* Don't substitute non-local labels, this confuses CFG. */ + if (GET_CODE (trial) == LABEL_REF + && LABEL_REF_NONLOCAL_P (trial)) + continue; + SET_SRC (sets[i].rtl) = trial; cse_jumps_altered = 1; break; diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index a01b99a0425..64db8c4258f 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -1010,6 +1010,11 @@ update_equiv_regs (void) if (! INSN_P (insn)) continue; + /* Don't substitute into a non-local goto, this confuses CFG. */ + if (JUMP_P (insn) + && find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX)) + continue; + for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) { if (REG_NOTE_KIND (link) == REG_DEAD