regrename: Fix -fcompare-debug issue in find_rename_reg [PR103756]
authorJakub Jelinek <jakub@redhat.com>
Thu, 30 Dec 2021 21:25:34 +0000 (22:25 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 30 Dec 2021 21:25:34 +0000 (22:25 +0100)
commit6c684aa50d4eef28bb59ebb4664f362662845cd6
tree209287f89f026bc7eefb42fc9133380f7b36f308
parent5545d1edcbdb1701443f94dde7ec97c5ce3e1a6c
regrename: Fix -fcompare-debug issue in find_rename_reg [PR103756]

The r12-5978 change caused a -fcompare-debug issue, because without
-g a chain might start with a noop move, but with -g there could be
one or more DEBUG_INSNs in the chain before the noop move and so
regrename could make different decisions between -g and -g0.

Note, I must say I don't really understand the original change much,
if we want to make sure the noop moves are removed, couldn't regrename
during building of those du chains simply remove the noop moves instead?

2021-12-30  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/103756
* regrename.c (find_rename_reg): Test noop_move_p on the first
non-debug insn in the chain rather than on the first insn.

* g++.dg/opt/pr103756.C: New test.
gcc/regrename.c
gcc/testsuite/g++.dg/opt/pr103756.C [new file with mode: 0644]