http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496

--- Comment #4 from Vladimir Makarov <vmakarov at redhat dot com> 2011-04-11 
17:11:37 UTC ---
The new big IRA patch just triggered a latent reload bug.

The code in question is in function reload_as_needed

              /* If this was an ASM, make sure that all the reload insns
                 we have generated are valid.  If not, give an error
                 and delete them.  */
              if (asm_noperands (PATTERN (insn)) >= 0)
                for (p = NEXT_INSN (prev); p != next; p = NEXT_INSN (p))
                  if (p != insn && INSN_P (p)
                      && GET_CODE (PATTERN (p)) != USE
                      && (recog_memoized (p) < 0
                          || (extract_insn (p), ! constrain_operands (1))))
                    {
                      error_for_asm (insn,
                                     "%<asm%> operand requires "
                                     "impossible reload");
                      delete_insn (p);
                    }
            }

A previous insn P has a spilled pseudo and that results in the error generation
because spilled pseudos are changed by memory later.

I guess the above code is wrong if a previous insn has a spilled pseudo.

The bug did not occur before the big IRA patch because the pseudo in question
happened not to be spilled.  I should mention that it is more profitable to
spill the pseudo and the new IRA makes the right decision (which results in
live range shrinkage and decreasing register pressure).

I could make a patch (preventing the error generation if there are spilled
pseudos in insn P) but I think that reload maintainers would do that different
(e.g. moving the check after changing spilled pseudos by memory) or make a
better patch.

Reply via email to