diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2021-04-17 18:06:17 +0000 |
---|---|---|
committer | Segher Boessenkool <segher@kernel.crashing.org> | 2021-04-18 15:01:13 +0000 |
commit | b412ce8e961052e6becea3bc783a53e1d5feaa0f (patch) | |
tree | 8b12ec63c1ef33276bbc7bfbb839bd27ffc20f85 /gcc/combine.c | |
parent | da946b41be521adb68bbe8695563b380cd8b3243 (diff) | |
download | gcc-b412ce8e961052e6becea3bc783a53e1d5feaa0f.zip gcc-b412ce8e961052e6becea3bc783a53e1d5feaa0f.tar.gz gcc-b412ce8e961052e6becea3bc783a53e1d5feaa0f.tar.bz2 |
combine: Don't create REG_UNUSED notes if the reg already died (PR99927)
If the register named in an existing REG_UNUSED note dies somewhere
between where the note used to be and I3, we should just drop it.
2021-04-21 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/99927
* combine.c (distribute_notes) [REG_UNUSED]: If the register already
is dead, just drop it.
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 9063a07..62bf4ae 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -14366,6 +14366,11 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2, we keep notes from i2 or i1 if they will turn into REG_DEAD notes. */ + /* If this register is set or clobbered between FROM_INSN and I3, + we should not create a note for it. */ + if (reg_set_between_p (XEXP (note, 0), from_insn, i3)) + break; + /* If this register is set or clobbered in I3, put the note there unless there is one already. */ if (reg_set_p (XEXP (note, 0), PATTERN (i3))) |