From baf3b9b2e5259558ef86bd62398e2ccecd7a4a4c Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sat, 18 Apr 2020 09:39:18 -0600 Subject: 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. --- gcc/regrename.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gcc/regrename.c') 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; } -- cgit v1.2.3