diff options
author | Jeff Law <law@redhat.com> | 2020-04-18 09:39:18 -0600 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2020-04-18 09:39:18 -0600 |
commit | baf3b9b2e5259558ef86bd62398e2ccecd7a4a4c (patch) | |
tree | e6f26876f0c50c218be7ffbd8a442c88769f533d /gcc/regrename.c | |
parent | b57e1621eb76ba80c949ad098829aa8171a8c4ab (diff) |
Don't let DEBUG_INSNSs change register renaming decisions
PR debug/94439
* regrename.c (check_new_reg_p): Ignore DEBUG_INSNs when walking
the chain.
PR debug/94439
* gcc.dg/torture/pr94439.c: New test.
Diffstat (limited to 'gcc/regrename.c')
-rw-r--r-- | gcc/regrename.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/regrename.c b/gcc/regrename.c index 663935b7ec1..669a6ead705 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -348,11 +348,17 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg, /* See whether it accepts all modes that occur in definition and uses. */ for (tmp = this_head->first; tmp; tmp = tmp->next_use) - if ((!targetm.hard_regno_mode_ok (new_reg, GET_MODE (*tmp->loc)) - && ! DEBUG_INSN_P (tmp->insn)) - || call_clobbered_in_chain_p (this_head, GET_MODE (*tmp->loc), - new_reg)) - return false; + { + /* Completely ignore DEBUG_INSNs, otherwise we can get + -fcompare-debug failures. */ + if (DEBUG_INSN_P (tmp->insn)) + continue; + + if (!targetm.hard_regno_mode_ok (new_reg, GET_MODE (*tmp->loc)) + || call_clobbered_in_chain_p (this_head, GET_MODE (*tmp->loc), + new_reg)) + return false; + } return true; } |