Comments

Reload (find_reloads) has code that can replace a register with a
label_ref when presented with RTL of the form:
(set (reg) (reg) (notes (rtx_equal (label_ref)))
Label references are initially counted in jump.c:mark_all_labels() and
friends. This code traverses the RTL and counts each observed label_ref.
The code inserts REG_LABEL_OPERAND or REG_LABEL_TARGET as appropriate.
Notes are not traversed therefore the (rtx_equal (label_ref)) shown
above is not treated as a reference.
Instruction deletion, in cfgrtl.c:delete_insn() does not re-traverse the
RTL, The code traverses only the notes looking for REG_LABEL_OPERAND and
REG_TARGET_OPERAND notes in order to count down the label_nuses field.
The code in reload.c:find_reloads() converts a register to a label_ref
and inserts the associated REG_LABEL_OPERAND but does not adjust
label_nuses, this may result in the inappropriate deletion of a live label.
This issue was discovered during the development of the ARM aarch64 gcc
backend and results in an ICE due to deletion of a live jump table.
The issue has not been re-created on another target. The proposed patch
has been regressed on x86 (and aarch64).
Proposed ChangeLog entry below, patch attached:
2012-01-04 Marcus Shawcroft <marcus.shawcroft@arm.com>
* reload.c (find_reloads): Adjust LABEL_NUSES on
REG_LABEL_OPERAND insertion.
/Marcus

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/04/12 07:07, Marcus Shawcroft wrote:
> Reload (find_reloads) has code that can replace a register with a > label_ref when presented with RTL of the form:> > (set (reg) (reg) (notes (rtx_equal (label_ref)))> > Label references are initially counted in jump.c:mark_all_labels()> and friends. This code traverses the RTL and counts each observed> label_ref. The code inserts REG_LABEL_OPERAND or REG_LABEL_TARGET> as appropriate. Notes are not traversed therefore the (rtx_equal> (label_ref)) shown above is not treated as a reference.> > Instruction deletion, in cfgrtl.c:delete_insn() does not> re-traverse the RTL, The code traverses only the notes looking for> REG_LABEL_OPERAND and REG_TARGET_OPERAND notes in order to count> down the label_nuses field.> > The code in reload.c:find_reloads() converts a register to a> label_ref and inserts the associated REG_LABEL_OPERAND but does not> adjust label_nuses, this may result in the inappropriate deletion> of a live label.> > This issue was discovered during the development of the ARM aarch64> gcc backend and results in an ICE due to deletion of a live jump> table.> > The issue has not been re-created on another target. The proposed> patch has been regressed on x86 (and aarch64).> > Proposed ChangeLog entry below, patch attached:> > 2012-01-04 Marcus Shawcroft <marcus.shawcroft@arm.com>> > * reload.c (find_reloads): Adjust LABEL_NUSES on REG_LABEL_OPERAND> insertion.
Approved after you fix some minor fomatting nits. Your code has:
++ LABEL_NUSES(XEXP (substitution, 0));
The line should be:
++LABEL_NUSES (XEXP (substitution, 0));
No space between autoincrement operator and its operand.
Space before the open paren of the XEXP
Thanks,
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJPBKbUAAoJEBRtltQi2kC7wMcH/3UMAgEj7d7nXwPfuMaZSl84
6lme27/Ox8LxsqFYrqnR3QKdU3/B0aZmS/CVzrPQQoC/xTSy1Y0aPTyBx3+p7tqa
tVkcCl/PgjhNCFROLe0n7YZ9FoS3el8CyC7Yha9Z0C17fiv6tetCElijiSluOxB0
OeOxgzE1qekwsQSZs6ZEiTpxGQJ/POqlhHHC9ILZV+iEUfGTAHW1EdKTupsLx9Q1
o26gXu6mTGsLEuSLkdKLkPJ+1+wV4h3291Ec41FC8Eo1E4fB9H82vBXxvy8fvO35
VnHXuyLrr7LMN0REDiQ6Oz8yh52Un/76l5/+kjFBPdQ6RzNPFsu8qwboNRirWSI=
=fNJ9
-----END PGP SIGNATURE-----