On 02/14/2018 04:01 PM, Jakub Jelinek wrote:
Hi! Unlike normal insns where SUBREGs must properly validate, in DEBUG_INSNs we allow arbitrary SUBREGs, either the dwarf2out code will be able to use it, or it will just punt. The reason for it is among other things that during analysis we usually need to ignore debug insns, so can't reject some optimization just because it would create subreg in debug insn that doesn't validate, and resetting such debug insns is too big hammer. On the following testcase on i?86 we ICE because we have a SFmode pseudo and want to use a XFmode new_reg for it and such subreg doesn't validate on i386. Fixed by using gen_rtx_raw_SUBREG in DEBUG_INSNs as other passes do. We don't have gen_lowpart_raw_SUBREG, so the patch inlines what gen_lowpart_SUBREG does to compute the offset and uses gen_rtx_{,raw_}SUBREG in all cases. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Yes. Thank you, Jakub.
2018-02-14 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/83723 * lra-int.h (lra_substitute_pseudo): Add DEBUG_P argument. * lra.c (lra_substitute_pseudo): Likewise. If true, use gen_rtx_raw_SUBREG instead of gen_rtx_SUBREG. Pass DEBUG_P to recursive calls. (lra_substitute_pseudo_within_insn): Adjust lra_substitute_pseudo callers. * lra-constraints.c (inherit_reload_reg, split_reg): Likewise. * gcc.dg/pr83723.c: New test.