summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2005-03-22 03:48:44 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2005-03-22 03:48:44 +0000
commit17c9bcdd2886e8243937d80e45f9315f472a395d (patch)
tree49b678c9ba3b7d15c623064be8b7ac677529e32b
parent9d7cb254255ee037f4b0852c661a5a5212353d1c (diff)
downloadgcc-17c9bcdd2886e8243937d80e45f9315f472a395d.tar.gz
re PR rtl-optimization/20527 (Mishandling of postincrement causes bzip2 miscompilation.)
PR rtl-optimization/20527 * combine.c (can_combine_p) [AUTO_INC_DEC]: When INSN has an REG_INC note, test that the register also isn't mentioned in PRED or SUCC. From-SVN: r96853
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/combine.c10
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 42b4ac99dc3..0bc1367cf34 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-22 Hans-Peter Nilsson <hp@axis.com>
+
+ PR rtl-optimization/20527
+ * combine.c (can_combine_p) [AUTO_INC_DEC]: When INSN has an
+ REG_INC note, test that the register also isn't mentioned in PRED
+ or SUCC.
+
2005-03-22 Ben Elliston <bje@au.ibm.com>
* dwarf2out.c (dwarf_type_encoding_name): Remove unused prototype
diff --git a/gcc/combine.c b/gcc/combine.c
index 5981403eea9..297b58e914e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1314,9 +1314,9 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ,
if (INSN_P (p) && p != succ && volatile_insn_p (PATTERN (p)))
return 0;
- /* If INSN or I2 contains an autoincrement or autodecrement,
- make sure that register is not used between there and I3,
- and not already used in I3 either.
+ /* 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. */
@@ -1325,6 +1325,10 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ,
if (REG_NOTE_KIND (link) == REG_INC
&& (JUMP_P (i3)
|| reg_used_between_p (XEXP (link, 0), insn, i3)
+ || (pred != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred)))
+ || (succ != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (succ)))
|| reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i3))))
return 0;
#endif