[PATCH] D139732: [AMDGPU] Add pass to rewrite partially used virtual superregisters after RenameIndependentSubregs pass with registers of minimal size.

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 06:30:27 PST 2023


vpykhtin added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/LiveInterval.h:713
                                    /// ranges.
-    const Register Reg; // the register or stack slot of this interval.
+    Register Reg;       // the register or stack slot of this interval.
     float Weight = 0.0; // weight of this interval
----------------
qcolombet wrote:
> arsenm wrote:
> > These generic header changes should be split into a separate patch, at first glance I don't understand why they are necessary
> That change looks very wrong to me.
> 
> If we want to "update" a live interval so that it points to a different register, the proper way to do this is to create a new one and shrink/remove the old one.
> 
> We have plenty of helper functions to do that.
> Look at `LiveIntervals::createEmptyInterval`, `LiveIntervals::extendSegmentsToUses`, `LiveIntervals::shrinkToUses`, etc.
Honestly I did this with a heavy heart but in my case I only need to copy existing interval excluding "covering" subreg subrange, which should match main range, and fix lanemasks for the shifted subreg subranges. Maybe I can copy main range and then move subranges from old interval to the new one, do you think it would be better?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139732



More information about the llvm-commits mailing list