On 12/09/18 12:29, Andrew Stubbs wrote:
I'll report back when I've done more testing.
I reproduced the problem, in the latest sources, with the
SPECIAL_REGNO_P patch removed (and HARD_REGNO_RENAME_OK adjusted
accordingly).
Testcase: gcc.c-torture/compile/20020706-2.c -O3 -funroll-loops
during RTL pass: rnreg
dump file: /scratch/astubbs/amd/upstream/tmp/target.290r.rnreg
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/testsuite/gcc.c-torture/compile/20020706-2.c: In function 'crashIt':
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/testsuite/gcc.c-torture/compile/20020706-2.c:26:1: internal compiler error: in merge_overlapping_regs, at regrename.c:300
26 | }
| ^
0xef149d merge_overlapping_regs
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/regrename.c:300
0xef17cb find_rename_reg(du_head*, reg_class, unsigned long (*) [7], int, bool)
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/regrename.c:373
0xef1c84 rename_chains
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/regrename.c:497
0xef612b regrename_optimize
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/regrename.c:1951
0xef61ae execute
/scratch/astubbs/amd/upstream/src/gcc-gcn-master/gcc/regrename.c:1986
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://sourcery.mentor.com/GNUToolchain/> for instructions.
The register that find_rename_reg is considering is SCC, which is one of
the "special" registers. There is a short-cut in rename_chains for
fixed registers, global registers, and frame pointers. It does not
check HARD_REGNO_RENAME_OK.
Presumably the bug is not that it will actually try to rename SCC, but
that it trips an assert while trying to compute the other parameter for
the HARD_REGNO_RENAME_OK hook.
The SPECIAL_REGNO_P macro fixed the issue by extending the short-cut to
include the additional registers.
The assert is caused because the def-use chains indicate that SCC
conflicts with itself. I suppose the question is why is it doing that,
but it's probably do do with that being a special register that gets
used in split2 (particularly by the addptrdi3 pattern). Although, those
patterns are careful to save SCC to one side and then restore it again
after, so I'd have thought the DF analysis would work out?
Andrew