https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78103

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If reusing i2dest for the find_split_case is fine (I must say I'm a little bit
worried about uses of the pseudo in debug insns, whether if we reuse it for
something else we properly adjust those insns (or reset them)), what the code
does in the:
          rtx newdest = i2dest;
...
          /* Get NEWDEST as a register in the proper mode.  We have already
             validated that we can do this.  */
          if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode)
            {
              if (REGNO (i2dest) < FIRST_PSEUDO_REGISTER)
                newdest = gen_rtx_REG (split_mode, REGNO (i2dest));
              else
                {
                  SUBST_MODE (regno_reg_rtx[REGNO (i2dest)], split_mode);
                  newdest = regno_reg_rtx[REGNO (i2dest)];
                }
            }
code if the if condition is false, can't it also try to reuse i2dest in the
      else if (m_split_insn && NEXT_INSN (NEXT_INSN (m_split_insn)) == NULL_RTX
               && (next_nonnote_nondebug_insn (i2) == i3
                   || !modified_between_p (PATTERN (m_split_insn), i2, i3)))
case (if it verifies i2dest doesn't appear anywhere in i2set and i3set) by
rewriting the SET_DEST of the i2set and all uses of it in i3set with i2dest if
the mode matches?
On the other side the
             Since nowadays we can create registers during combine just fine,
             we should just create a new one here, not reuse i2dest.  */
comment says we should prefer creating new regs.  If so, fine, but then we
shouldn't just distribute the preexisting i3links, i2links etc., but should try
to create new ones.  I see the code does:
    LOG_LINKS (i3) = NULL;
    REG_NOTES (i3) = 0;
    LOG_LINKS (i2) = NULL;
    REG_NOTES (i2) = 0;
and then somewhat later
    distribute_links (i3links);
    distribute_links (i2links);
    distribute_links (i1links);
    distribute_links (i0links);
so distributes preexisting log links, but I don't see anything that would
similarly handle newly added pseudos from the combine_split_insns, create new
log link for that, record_value_for_reg etc.

Reply via email to