[llvm] [PowerPC] Add phony subregisters to cover the high half of the VSX registers. (PR #94628)

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 08:52:00 PDT 2024


================
@@ -3672,6 +3672,14 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) {
     // having stale segments.
     LHSVals.pruneMainSegments(LHS, ShrinkMainRange);
 
+    LHSVals.pruneSubRegValues(LHS, ShrinkMask);
+    RHSVals.pruneSubRegValues(LHS, ShrinkMask);
+  } else if (TrackSubRegLiveness && !CP.getDstIdx() && CP.getSrcIdx()) {
+    LHS.createSubRangeFrom(LIS->getVNInfoAllocator(),
+                           CP.getNewRC()->getLaneMask(), LHS);
+    mergeSubRangeInto(LHS, RHS, TRI->getSubRegIndexLaneMask(CP.getSrcIdx()), CP,
+                      CP.getDstIdx());
+    LHSVals.pruneMainSegments(LHS, ShrinkMainRange);
     LHSVals.pruneSubRegValues(LHS, ShrinkMask);
     RHSVals.pruneSubRegValues(LHS, ShrinkMask);
----------------
bzEq wrote:

> I'm not sure what you mean by RHS doesn't contain any subregs.

`RHS` as a LiveInterval doesn't contain any subranges(if it does, another branch prior this one has handled that). Looking into `pruneSubRegValues`, the method will iterate over LiveInterval's subranges and shrink range accordingly. Since `RHS` doesn't contain any subranges, so `RHS` should not be changed.

https://github.com/llvm/llvm-project/pull/94628


More information about the llvm-commits mailing list