aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SplitKit.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-11-21 20:24:12 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-11-21 20:24:12 +0000
commit73c8a9bc2f543c97c36acbc501e0b394f6c73721 (patch)
tree1bc2ab5d629950bb7f1321aa9925a5c82e37b5f2 /llvm/lib/CodeGen/SplitKit.cpp
parent6af8e6c3d533c756449366716b63672260fb9279 (diff)
downloadllvm-73c8a9bc2f543c97c36acbc501e0b394f6c73721.zip
llvm-73c8a9bc2f543c97c36acbc501e0b394f6c73721.tar.gz
llvm-73c8a9bc2f543c97c36acbc501e0b394f6c73721.tar.bz2
Check proper live range in extendPHIRanges
The function extendPHIRanges checks the main range of the original live interval, even when dealing with a subrange. This could also lead to an assert when the subrange is not live at the extension point, but the main range is. To avoid this, check the corresponding subrange of the original live range, instead of always checking the main range. Review (as a part of a bigger set of changes): https://reviews.llvm.org/D26359 llvm-svn: 287571
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r--llvm/lib/CodeGen/SplitKit.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index 2d5a9d6..b881c6d6 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -1092,13 +1092,19 @@ static bool removeDeadSegment(SlotIndex Def, LiveRange &LR) {
}
void SplitEditor::extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
- LiveRange &LR, ArrayRef<SlotIndex> Undefs) {
+ LiveRange &LR, LaneBitmask LM,
+ ArrayRef<SlotIndex> Undefs) {
for (MachineBasicBlock *P : B.predecessors()) {
SlotIndex End = LIS.getMBBEndIdx(P);
SlotIndex LastUse = End.getPrevSlot();
// The predecessor may not have a live-out value. That is OK, like an
// undef PHI operand.
- if (Edit->getParent().liveAt(LastUse))
+ LiveInterval &PLI = Edit->getParent();
+ // Need the cast because the inputs to ?: would otherwise be deemed
+ // "incompatible": SubRange vs LiveInterval.
+ LiveRange &PSR = (LM != ~0u) ? getSubRangeForMask(LM, PLI)
+ : static_cast<LiveRange&>(PLI);
+ if (PSR.liveAt(LastUse))
LRC.extend(LR, End, /*PhysReg=*/0, Undefs);
}
}
@@ -1120,7 +1126,7 @@ void SplitEditor::extendPHIKillRanges() {
LiveRangeCalc &LRC = getLRCalc(RegIdx);
MachineBasicBlock &B = *LIS.getMBBFromIndex(V->def);
if (!removeDeadSegment(V->def, LI))
- extendPHIRange(B, LRC, LI, /*Undefs=*/{});
+ extendPHIRange(B, LRC, LI, ~0u, /*Undefs=*/{});
}
SmallVector<SlotIndex, 4> Undefs;
@@ -1141,7 +1147,7 @@ void SplitEditor::extendPHIKillRanges() {
&LIS.getVNInfoAllocator());
Undefs.clear();
LI.computeSubRangeUndefs(Undefs, PS.LaneMask, MRI, *LIS.getSlotIndexes());
- extendPHIRange(B, SubLRC, S, Undefs);
+ extendPHIRange(B, SubLRC, S, PS.LaneMask, Undefs);
}
}
}