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

--- Comment #4 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
There are probably a lot of analogous problem reports.  I'll try to put some
analysis of the issue.

Before IRA we have the following code:

    2: r90:DI=di:DI
      REG_DEAD di:DI
    3: r91:DI=si:DI
      REG_DEAD si:DI
   21: clobber r88:TI
   22: r88:TI#0=r90:DI
      REG_DEAD r90:DI
   23: r88:TI#8=r91:DI
      REG_DEAD r91:DI
    7: r92:TI=dx:TI
      REG_DEAD dx:TI
   11: {r93:TI=r88:TI+r92:TI;clobber flags:CC;}
      REG_DEAD r92:TI
      REG_DEAD r88:TI
      REG_UNUSED flags:CC
   16: ax:TI=r93:TI
      REG_DEAD r93:TI

GCC 4.8 has a bit different input code where pseudo 93 and 88 are coalesced by
regmove pass.  Regmove was deleted in gcc-4.9.  Coalescing is a tricky thing. 
As heuristic it can give a good (as in this case) and a bad result (e.g. making
live range of pseudos longer makes more spills by deleting natural points for
live range splitting).  When I removed regmove I did a lot of performance
benchmarking on SPEC to justify it.  So on most widely used and credible
benchmarks, deleting regmove did not worsen the performance.

Still this problem can be solved without coalescing (or returning regmove
pass).  If we propagate preferences of pseudos 90/91 to pseudo 88.  It is not
done yet as RA considers pseudo 88 conflicting with 90 and 91.  The culprit is
a pattern

   21: clobber r88:TI
   22: r88:TI#0=r90:DI
      REG_DEAD r90:DI
   23: r88:TI#8=r91:DI
      REG_DEAD r91:DI

Neither current IRA/LRA nor previous regmove/local/global/reload recognized
that there is no conflict of p88 with p90/p91.

If we implement the right processing of such pattern (or at least that p88 does
not conflict with p90), we solve the problem (and many others reported).

I am not sure that I can do this for GCC-7 (as it most probably involves LRA
too) but it could be definitely done for GCC8.

Reply via email to