[PATCH] Allow the RegisterCoalescer to remove copies to reserved registers

hfinkel at anl.gov hfinkel at anl.gov
Wed Jan 14 17:21:28 PST 2015

In http://reviews.llvm.org/D6978#108887, @qcolombet wrote:

> > Do you know if I need to do anything specific here, or will the register replacement code that already exists take care of this in a sufficient way?
> Ah sorry, I forgot to reply to this as I first pushed for the copy propagation :).
>  The existing register replacement code should handle this case just fine. Thought that may not be well tested :P.

Sounds good; we'll find out ;) -- Also, as it turns out, this entire thing only applies to reserved registers:

  /// Return true if a copy involving a physreg should be joined.
  bool RegisterCoalescer::canJoinPhys(const CoalescerPair &CP) {
    /// Always join simple intervals that are defined by a single copy from a
    /// reserved register. This doesn't increase register pressure, so it is
    /// always beneficial.
    if (!MRI->isReserved(CP.getDstReg())) {
      DEBUG(dbgs() << "\tCan only merge into reserved registers.\n");
      return false;

So we're good as-is.

> Thanks,

>  Q.



More information about the llvm-commits mailing list