[regrename] Fix PR87330 : ICE in scan_rtx_reg, at regrename.c

Message ID CAAdirjzj2+Zg2frrZJG8gd4O4urZRWFy9kqJ90CPA8inpq0hbQ@mail.gmail.com
State New
Headers show
Series
  • [regrename] Fix PR87330 : ICE in scan_rtx_reg, at regrename.c
Related show

Commit Message

Sameera Deshpande Oct. 8, 2018, 10:23 p.m.
Hi!

Please find attached the patch fixing the issue PR87330 : ICE in
scan_rtx_reg, at regrename.c:1097.
The regrename pass does not rename the registers which are in notes,
because of which the REG_DEAD note had previous register names, which
caused conflicting liveness information generated for tag collision
pass.

It is better to do it in regrename_do_replace instead while
regrename_analyze, because the note information does not really
contribute into the regrename analysis, hence need not be added in the
def-use chains that are computed. regrename_do_replace is where the
decision to finally rename the register is made - where the note can
be altered with new regname.

Other notes need not be changed, as they don't hold renamed register
information.

Ok for trunk?

Changelog:

2018-10-09 Sameera Deshpande <sameera.deshpande@linaro.org

* gcc/regrename.c (regrename_do_replace): Add condition to alter
regname if note has same register marked dead in notes.

Comments

Eric Botcazou Oct. 8, 2018, 10:38 p.m. | #1
> Other notes need not be changed, as they don't hold renamed register
> information.
> 
> Ok for trunk?

No, REG_DEAD & REG_UNUSED note must be recomputed by passes consuming them.

> 2018-10-09 Sameera Deshpande <sameera.deshpande@linaro.org
> 
> * gcc/regrename.c (regrename_do_replace): Add condition to alter
> regname if note has same register marked dead in notes.

No gcc/ prefix in gcc/ChangeLog.

Patch

diff --git a/gcc/regrename.c b/gcc/regrename.c
index 8424093..a3446a2 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -970,6 +970,7 @@  regrename_do_replace (struct du_head *head, int reg)
       unsigned int regno = ORIGINAL_REGNO (*chain->loc);
       struct reg_attrs *attr = REG_ATTRS (*chain->loc);
       int reg_ptr = REG_POINTER (*chain->loc);
+      rtx note;
 
       if (DEBUG_INSN_P (chain->insn) && REGNO (*chain->loc) != base_regno)
 	validate_change (chain->insn, &(INSN_VAR_LOCATION_LOC (chain->insn)),
@@ -986,6 +987,11 @@  regrename_do_replace (struct du_head *head, int reg)
 	      last_reg = *chain->loc;
 	    }
 	  validate_change (chain->insn, chain->loc, last_repl, true);
+	  note = find_regno_note (chain->insn, REG_DEAD, base_regno);
+	  if (note != 0)
+	    {
+	      validate_change (chain->insn, &XEXP (note, 0), last_repl, true);
+	    }
 	}
     }