[llvm] [regalloc][LiveRegMatrix][AMDGPU] Fix LiveInterval dangling pointers in LiveRegMatrix. (PR #168556)

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 11:51:44 PST 2026


================
@@ -79,6 +79,19 @@ void LiveIntervalUnion::extract(const LiveInterval &VirtReg,
   }
 }
 
+void LiveIntervalUnion::clearAllSegmentsReferencing(
+    const LiveInterval &VirtReg) {
+  ++Tag;
+
+  // Remove all segments referencing VirtReg.
+  for (SegmentIter SegPos = Segments.begin(); SegPos.valid();) {
+    if (SegPos.value() == &VirtReg)
----------------
vpykhtin wrote:

well, you're right, the address can be reused by some other new interval. This complicates the description of the LiveInterval object we're going to delete - it should be present in LiveIntervals, has valid register value, but can have empty range(s)

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


More information about the llvm-commits mailing list