[PATCH] D140496: [TailDuplicator] Fix old bugs in TailDuplicator::duplicateInstruction

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 07:53:29 PST 2023


bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:454
               NewRC = OrigRC;
             Register NewReg = MRI->createVirtualRegister(NewRC);
             BuildMI(*PredBB, NewMI, NewMI.getDebugLoc(),
----------------
kparzysz wrote:
> Maybe we can just use `OrigRC` here, instead of trying to come up with a new class?  `OrigRC` is guaranteed to be valid, since that's what the original code used.
> 
Yes. That is an alternative solution.

If I remember correct I tried to avoid changing the behavior for the non-faulty case (assuming that there was some good reason why the old code tried to find a new RC here).

Since register coalescing is doing register class widening (taking getLargestLegalSuperClass into consideration) I don't think that it is important to find a "better" class here. And there are no lit tests that are impacted if I simplify this to just use OrigRC (and I haven't seen any regressions in downstream testing either). 

I'll update the patch accordingly, to simplify this part.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140496/new/

https://reviews.llvm.org/D140496



More information about the llvm-commits mailing list