[llvm] [RegisterCoalescer] Prune live range of early-clobber from live-in (PR #157628)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 19:03:47 PDT 2025


================
@@ -665,7 +665,10 @@ void LiveIntervals::extendToIndices(LiveRange &LR,
 void LiveIntervals::pruneValue(LiveRange &LR, SlotIndex Kill,
                                SmallVectorImpl<SlotIndex> *EndPoints) {
   LiveQueryResult LRQ = LR.Query(Kill);
-  VNInfo *VNI = LRQ.valueOutOrDead();
+  // LR may have liveness reachable from early clobber killer, which may be
+  // only live-in instead of live-out of the instruction.
+  // For example, LR =[1r, 3r), Kill = 3e, we have to prune [3e, 3r) of LR.
+  VNInfo *VNI = Kill.isEarlyClobber() ? LRQ.valueIn() : LRQ.valueOutOrDead();
----------------
arsenm wrote:

This feels like it shouldn't require special casing based on the position? 

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


More information about the llvm-commits mailing list