diff options
author | segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-09 10:21:06 +0000 |
---|---|---|
committer | segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-09 10:21:06 +0000 |
commit | e0a2e479b1f200474af5967c10c797126c5568ac (patch) | |
tree | 80ec430a80ffc8d86557d7045e7d649879035792 | |
parent | b534f4be6f8618edc28a3179a4a092959cc8a8a1 (diff) | |
download | gcc-e0a2e479b1f200474af5967c10c797126c5568ac.tar.gz |
Backport from mainline
2017-11-01 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/64682
PR rtl-optimization/69567
PR rtl-optimization/69737
PR rtl-optimization/82683
* combine.c (distribute_notes) <REG_DEAD>: If the new I2 sets the same
register mentioned in the note, drop the note, unless it came from I3,
in which case it should go to I3 again.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@254564 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/combine.c | 16 |
2 files changed, 24 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03b28b7a7ca..3ede67dd3a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2017-11-09 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from mainline + 2017-11-01 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/64682 + PR rtl-optimization/69567 + PR rtl-optimization/69737 + PR rtl-optimization/82683 + * combine.c (distribute_notes) <REG_DEAD>: If the new I2 sets the same + register mentioned in the note, drop the note, unless it came from I3, + in which case it should go to I3 again. + 2017-11-07 Eric Botcazou <ebotcazou@adacore.com> Backport from mainline diff --git a/gcc/combine.c b/gcc/combine.c index 1cf8c1cd141..fff1c7e7bd4 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -14230,6 +14230,17 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2, && CALL_P (from_insn) && find_reg_fusage (from_insn, USE, XEXP (note, 0))) place = from_insn; + else if (i2 && reg_set_p (XEXP (note, 0), PATTERN (i2))) + { + /* If the new I2 sets the same register that is marked + dead in the note, we do not in general know where to + put the note. One important case we _can_ handle is + when the note comes from I3. */ + if (from_insn == i3) + place = i3; + else + break; + } else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3))) place = i3; else if (i2 != 0 && next_nonnote_nondebug_insn (i2) == i3 @@ -14243,11 +14254,6 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2, || rtx_equal_p (XEXP (note, 0), elim_i0)) break; tem_insn = i3; - /* If the new I2 sets the same register that is marked dead - in the note, we do not know where to put the note. - Give up. */ - if (i2 != 0 && reg_set_p (XEXP (note, 0), PATTERN (i2))) - break; } if (place == 0) |