From 74b9f8dfe18b51280ecb9b68e0de7d4f7e36e973 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Sun, 24 Nov 2019 13:20:55 +0000 Subject: [PATCH] Allow combiner to create autoinc in jump insns. * combine.c (can_combine_p): Allow autoinc in jumps. From-SVN: r278656 --- gcc/ChangeLog | 2 ++ gcc/combine.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5f94745c0da..823ceca45d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -5,6 +5,8 @@ * combine.c (combine_instructions): Record costs for jumps. + * combine.c (can_combine_p): Allow autoinc in jumps. + 2019-11-23 Jan Hubicka * cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT): Remove. diff --git a/gcc/combine.c b/gcc/combine.c index f480633061d..2e21459f504 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2110,22 +2110,19 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED, is_volatile_p = volatile_refs_p (PATTERN (insn)) ? volatile_refs_p : volatile_insn_p; - + for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p)) if (INSN_P (p) && p != succ && p != succ2 && is_volatile_p (PATTERN (p))) return 0; /* If INSN contains an autoincrement or autodecrement, make sure that register is not used between there and I3, and not already used in - I3 either. Neither must it be used in PRED or SUCC, if they exist. - Also insist that I3 not be a jump; if it were one - and the incremented register were spilled, we would lose. */ + I3 either. Neither must it be used in PRED or SUCC, if they exist. */ if (AUTO_INC_DEC) for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) if (REG_NOTE_KIND (link) == REG_INC - && (JUMP_P (i3) - || reg_used_between_p (XEXP (link, 0), insn, i3) + && (reg_used_between_p (XEXP (link, 0), insn, i3) || (pred != NULL_RTX && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred))) || (pred2 != NULL_RTX -- 2.30.2