[Bug rtl-optimization/80818] New: LRA clobbers live hard reg clobbered during rematerialization
krebbel at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 18 15:35:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818
Bug ID: 80818
Summary: LRA clobbers live hard reg clobbered during
rematerialization
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: krebbel at gcc dot gnu.org
Target Milestone: ---
Created attachment 41383
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41383&action=edit
Experimental patch
GCC revision: r248043
The live range for the following insn does not appear to be calculated
correctly:
(insn 1451 57711 1452 121 (parallel [
(set (reg:SI 1360 [ _2122 ])
(plus:SI (plus:SI (gtu:SI (reg:CCU 33 %cc)
(const_int 0 [0]))
(reg:SI 1404 [ _2207 ]))
(reg:SI 1427 [ _2244 ])))
(clobber (reg:CC 33 %cc))
]) "t.f90":61 1661 {*addsi3_alc}
(expr_list:REG_DEAD (reg:SI 1427 [ _2244 ])
(expr_list:REG_DEAD (reg:SI 1404 [ _2207 ])
(expr_list:REG_DEAD (reg:CCU 33 %cc)
(expr_list:REG_UNUSED (reg:CC 33 %cc)
(nil))))))
The CC reg is read as part of an operand but also clobbered in that insn.
The following operand registers are being recorded by lra:
{early_clobber_alts = 0, biggest_mode = SImode, type = OP_OUT, subreg_p = 0,
early_clobber = 0, regno = 1360, next = 0x4090910}
{early_clobber_alts = 0, biggest_mode = SImode, type = OP_IN, subreg_p = 0,
early_clobber = 0, regno = 1404, next = 0x40908f0}
{early_clobber_alts = 0, biggest_mode = SImode, type = OP_IN, subreg_p = 0,
early_clobber = 0, regno = 1427, next = 0x40908d0}
{early_clobber_alts = 0, biggest_mode = CCUmode, type = OP_IN, subreg_p = 0,
early_clobber = 0, regno = 33, next = 0x0}
and these hard regs:
{early_clobber_alts = 18446744073709551615, biggest_mode = CCmode, type =
OP_OUT, subreg_p = 0, early_clobber = 1, regno = 33, next = 0x0}
Marking the r33 entry early_clobber does not appear to be correct to me and
makes r33 dead before that insn.
The attached patch is a quick hack which prevents the early_clobber flag to be
set if the hard reg also appears also as input reg in an operand.
More information about the Gcc-bugs
mailing list