https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122274
--- Comment #4 from Surya Kumari Jangala <jskumari at gcc dot gnu.org> ---
Hi Andrew,
(In reply to Andrew Pinski from comment #2)
> Is the problem really an out of date REG_UNUSED here?
Are you suggesting that REG_UNUSED note is not needed on the following insn:
(insn/f 44 22 45 4 (set (reg:DI 0 0)(reg:DI 96 lr)) "foo.cpp":23:1 694
{*movdi_internal64}
(expr_list:REG_DEAD (reg:DI 96 lr)
(expr_list:REG_UNUSED (reg:DI 0 0)
(nil))))
Even if insn 44 does not have the REG_UNUSED note and it is not deleted by DCE,
cprop will replace r0 by r5 in insn 45.
For reference, insn 45 before cprop is:
(insn/f 45 44 46 4 (set (mem/c:DI (plus:DI (reg/f:DI 1 1)
(const_int 16 [0x10])) [18 S8 A8])
(reg:DI 0 0)) "foo.cpp":23:1 -1
(expr_list:REG_DEAD (reg:DI 0 0)
(nil)))
So now the CFI instructions that will be generated will be something like:
DW_CFA_register: r65 in r0
DW_CFA_offset_extended_sf: r5 at cfa+16
(Note: r65 is 'lr', the link register).
With this CFI, unwinding will not be possible.