aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds_cb1@t-online.de>2019-11-27 03:31:24 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2019-11-27 03:31:24 +0000
commitaf2f620578f46f09dba964ce5f739df0e61a595b (patch)
tree9102d9d21057f8555f20342ab2bcfcb106ac4025 /gcc
parent6821245b3fd9e392ca56dfab4a4921a59ffa234b (diff)
downloadgcc-af2f620578f46f09dba964ce5f739df0e61a595b.zip
gcc-af2f620578f46f09dba964ce5f739df0e61a595b.tar.gz
gcc-af2f620578f46f09dba964ce5f739df0e61a595b.tar.bz2
Allow autoinc in jumps, but only when using reload.
* auto-inc-dec.c (merge_in_block): Allow autoinc in jumps unless LRA is enabled. * combine.c (can_combine_p): Disallow autoinc in jumps unless LRA is disabled. From-SVN: r278756
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/auto-inc-dec.c7
-rw-r--r--gcc/combine.c8
3 files changed, 16 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ecade7b..358602d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-27 Bernd Schmidt <bernds_cb1@t-online.de>
+
+ * auto-inc-dec.c (merge_in_block): Allow autoinc in jumps unless
+ LRA is enabled.
+ * combine.c (can_combine_p): Disallow autoinc in jumps unless LRA is
+ disabled.
+
2019-11-27 Jakub Jelinek <jakub@redhat.com>
PR debug/92664
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index bdb6efa..1b224cc 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1441,10 +1441,9 @@ merge_in_block (int max_reg, basic_block bb)
continue;
}
- /* This continue is deliberate. We do not want the uses of the
- jump put into reg_next_use because it is not considered safe to
- combine a preincrement with a jump. */
- if (JUMP_P (insn))
+ /* Reload should handle auto-inc within a jump correctly, while LRA
+ is known to have issues with autoinc. */
+ if (JUMP_P (insn) && targetm.lra_p ())
continue;
if (dump_file)
diff --git a/gcc/combine.c b/gcc/combine.c
index 2e21459..3fbd84f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2117,12 +2117,16 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
/* 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. */
+ I3 either. Neither must it be used in PRED or SUCC, if they exist.
+ Also insist that I3 not be a jump if using LRA; if it were one
+ and the incremented register were spilled, we would lose.
+ Reload handles this correctly. */
if (AUTO_INC_DEC)
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_INC
- && (reg_used_between_p (XEXP (link, 0), insn, i3)
+ && ((JUMP_P (i3) && targetm.lra_p ())
+ || reg_used_between_p (XEXP (link, 0), insn, i3)
|| (pred != NULL_RTX
&& reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred)))
|| (pred2 != NULL_RTX