diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -651,14 +651,19 @@ // [ - i - ] // + // [ i ][ f ][ i ] + + // Save values for use after inserting a new interval. auto EndBitOfOverlap = FirstOverlap.stop(); + unsigned OverlapValue = FirstOverlap.value(); + + // Shorten the overlapping interval. FirstOverlap.setStop(StartBit); insertMemLoc(BB, Before, Var, FirstOverlap.start(), StartBit, - *FirstOverlap, VarLoc.DL); + OverlapValue, VarLoc.DL); // Insert a new interval to represent the end part. - FragMap.insert(EndBit, EndBitOfOverlap, *FirstOverlap); - insertMemLoc(BB, Before, Var, EndBit, EndBitOfOverlap, *FirstOverlap, + FragMap.insert(EndBit, EndBitOfOverlap, OverlapValue); + insertMemLoc(BB, Before, Var, EndBit, EndBitOfOverlap, OverlapValue, VarLoc.DL); // Insert the new (middle) fragment now there is space.