https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104778
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:77eb0461abe61a85f69270048ad81b25b1cc95d6 commit r12-7644-g77eb0461abe61a85f69270048ad81b25b1cc95d6 Author: Jakub Jelinek <ja...@redhat.com> Date: Mon Mar 14 14:49:09 2022 +0100 lra: Fix up debug_p handling in lra_substitute_pseudo [PR104778] The following testcase ICEs on powerpc-linux, because lra_substitute_pseudo substitutes (const_int 1) into a subreg operand. First a subreg of subreg of a reg appears in a debug insn (which surely is invalid outside of debug insns, but in debug insns we allow even what is normally invalid in RTL like subregs which the target doesn't like, because either dwarf2out is able to handle it, or we just throw away the location expression, making some var <optimized out>. lra_substitute_pseudo already has some code to deal with specifically SUBREG of REG with the REG being substituted for VOIDmode constant, but that doesn't cover this case, so the following patch extends lra_substitute_pseudo for debug_p mode to treat stuff like e.g. combiner's subst function to ensure we don't lose mode which is essential for the IL. 2022-03-14 Jakub Jelinek <ja...@redhat.com> PR debug/104778 * lra.cc (lra_substitute_pseudo): For debug_p mode, simplify SUBREG, ZERO_EXTEND, SIGN_EXTEND, FLOAT or UNSIGNED_FLOAT if recursive call simplified the first operand into VOIDmode constant. * gcc.target/powerpc/pr104778.c: New test.