diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-12-30 22:25:34 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-12-30 22:25:34 +0100 |
commit | 6c684aa50d4eef28bb59ebb4664f362662845cd6 (patch) | |
tree | 209287f89f026bc7eefb42fc9133380f7b36f308 /gcc/regrename.c | |
parent | 5545d1edcbdb1701443f94dde7ec97c5ce3e1a6c (diff) | |
download | gcc-6c684aa50d4eef28bb59ebb4664f362662845cd6.zip gcc-6c684aa50d4eef28bb59ebb4664f362662845cd6.tar.gz gcc-6c684aa50d4eef28bb59ebb4664f362662845cd6.tar.bz2 |
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.
Diffstat (limited to 'gcc/regrename.c')
-rw-r--r-- | gcc/regrename.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/regrename.c b/gcc/regrename.c index fe72fcc..c34ea6b 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -394,10 +394,15 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class, this_head, *unavailable)) return this_head->tied_chain->regno; - /* If this insn is a noop move, then do not rename in this chain as doing so - would inhibit removal of the noop move. */ - if (noop_move_p (this_head->first->insn)) - return best_new_reg; + /* If the first non-debug insn is a noop move, then do not rename in this + chain as doing so would inhibit removal of the noop move. */ + for (struct du_chain *tmp = this_head->first; tmp; tmp = tmp->next_use) + if (DEBUG_INSN_P (tmp->insn)) + continue; + else if (noop_move_p (tmp->insn)) + return best_new_reg; + else + break; /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass over registers that belong to PREFERRED_CLASS and try to find the |