Skip to content

Commit 4f26b46

Browse files
committed
Address reviewer feedback:
- Modify LiveRange::removeSegment so it handles intervals with no Segment - Update code to remove overlaps() checks - Remove addUsedIfAvailable of LiveIntervals
1 parent c3f698e commit 4f26b46

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

llvm/include/llvm/CodeGen/LiveInterval.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,9 @@ namespace llvm {
520520
endIndex() < End.getBoundaryIndex();
521521
}
522522

523-
/// Remove the specified segment from this range. Note that the segment
524-
/// must be a single Segment in its entirety.
523+
/// Remove the specified interval from this live range.
524+
/// Does nothing if interval is not part of this live range.
525+
/// Note that the interval must be within a single Segment in its entirety.
525526
void removeSegment(SlotIndex Start, SlotIndex End,
526527
bool RemoveDeadValNo = false);
527528

llvm/lib/CodeGen/LiveInterval.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,18 @@ VNInfo *LiveRange::extendInBlock(SlotIndex StartIdx, SlotIndex Kill) {
563563
return CalcLiveRangeUtilVector(this).extendInBlock(StartIdx, Kill);
564564
}
565565

566-
/// Remove the specified segment from this range. Note that the segment must
567-
/// be in a single Segment in its entirety.
566+
/// Remove the specified interval from this live range.
567+
/// Does nothing if interval is not part of this live range.
568+
/// Note that the interval must be within a single Segment in its entirety.
568569
void LiveRange::removeSegment(SlotIndex Start, SlotIndex End,
569570
bool RemoveDeadValNo) {
570571
// Find the Segment containing this span.
571572
iterator I = find(Start);
572-
assert(I != end() && "Segment is not in range!");
573+
574+
// No Segment found, so nothing to do.
575+
if (I == end())
576+
return;
577+
573578
assert(I->containsInterval(Start, End)
574579
&& "Segment is not entirely in range!");
575580

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,8 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
13121312
}
13131313
} else if (!isLiveOut && !isLastMBB) {
13141314
LI.removeSegment(StartIndex, EndIndex);
1315-
for (auto &SR : LI.subranges()) {
1316-
if (SR.overlaps(StartIndex, EndIndex))
1317-
SR.removeSegment(StartIndex, EndIndex);
1318-
}
1315+
for (auto &SR : LI.subranges())
1316+
SR.removeSegment(StartIndex, EndIndex);
13191317
}
13201318
}
13211319

llvm/lib/CodeGen/PHIElimination.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ INITIALIZE_PASS_END(PHIElimination, DEBUG_TYPE,
136136

137137
void PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const {
138138
AU.addUsedIfAvailable<LiveVariables>();
139-
AU.addUsedIfAvailable<LiveIntervals>();
140139
AU.addPreserved<LiveVariables>();
141140
AU.addPreserved<SlotIndexes>();
142141
AU.addPreserved<LiveIntervals>();

0 commit comments

Comments
 (0)