[llvm] RegisterCoalescer: Remove empty subranges after merging subranges (PR #222050)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 09:52:24 PDT 2026


================
@@ -3782,13 +3782,16 @@ RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) {
 
     LHSVals.pruneSubRegValues(LHS, ShrinkMask);
     RHSVals.pruneSubRegValues(LHS, ShrinkMask);
+
+    LHS.removeEmptySubRanges();
----------------
lucas-rami wrote:

Shouldn't this be called at the end of `mergeSubRangeInto` so that the function always leaves the live interval in a valid state? This would mirror `pruneSubRegValues` which also calls `removeEmptySubRanges` if it pruned anything.

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


More information about the llvm-commits mailing list