mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
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
This commit is contained in:
parent
76f5b630a8
commit
d671a9d054
@ -1092,13 +1092,19 @@ static bool removeDeadSegment(SlotIndex Def, LiveRange &LR) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SplitEditor::extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
|
void SplitEditor::extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
|
||||||
LiveRange &LR, ArrayRef<SlotIndex> Undefs) {
|
LiveRange &LR, LaneBitmask LM,
|
||||||
|
ArrayRef<SlotIndex> Undefs) {
|
||||||
for (MachineBasicBlock *P : B.predecessors()) {
|
for (MachineBasicBlock *P : B.predecessors()) {
|
||||||
SlotIndex End = LIS.getMBBEndIdx(P);
|
SlotIndex End = LIS.getMBBEndIdx(P);
|
||||||
SlotIndex LastUse = End.getPrevSlot();
|
SlotIndex LastUse = End.getPrevSlot();
|
||||||
// The predecessor may not have a live-out value. That is OK, like an
|
// The predecessor may not have a live-out value. That is OK, like an
|
||||||
// undef PHI operand.
|
// 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);
|
LRC.extend(LR, End, /*PhysReg=*/0, Undefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1120,7 +1126,7 @@ void SplitEditor::extendPHIKillRanges() {
|
|||||||
LiveRangeCalc &LRC = getLRCalc(RegIdx);
|
LiveRangeCalc &LRC = getLRCalc(RegIdx);
|
||||||
MachineBasicBlock &B = *LIS.getMBBFromIndex(V->def);
|
MachineBasicBlock &B = *LIS.getMBBFromIndex(V->def);
|
||||||
if (!removeDeadSegment(V->def, LI))
|
if (!removeDeadSegment(V->def, LI))
|
||||||
extendPHIRange(B, LRC, LI, /*Undefs=*/{});
|
extendPHIRange(B, LRC, LI, ~0u, /*Undefs=*/{});
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallVector<SlotIndex, 4> Undefs;
|
SmallVector<SlotIndex, 4> Undefs;
|
||||||
@ -1141,7 +1147,7 @@ void SplitEditor::extendPHIKillRanges() {
|
|||||||
&LIS.getVNInfoAllocator());
|
&LIS.getVNInfoAllocator());
|
||||||
Undefs.clear();
|
Undefs.clear();
|
||||||
LI.computeSubRangeUndefs(Undefs, PS.LaneMask, MRI, *LIS.getSlotIndexes());
|
LI.computeSubRangeUndefs(Undefs, PS.LaneMask, MRI, *LIS.getSlotIndexes());
|
||||||
extendPHIRange(B, SubLRC, S, Undefs);
|
extendPHIRange(B, SubLRC, S, PS.LaneMask, Undefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,10 +386,14 @@ private:
|
|||||||
/// Return true if any ranges were skipped.
|
/// Return true if any ranges were skipped.
|
||||||
bool transferValues();
|
bool transferValues();
|
||||||
|
|
||||||
/// Live range @p LR has a live PHI def at the beginning of block @p B.
|
/// Live range @p LR corresponding to the lane Mask @p LM has a live
|
||||||
/// Extend the range @p LR of all predecessor values that reach this def.
|
/// PHI def at the beginning of block @p B. Extend the range @p LR of
|
||||||
|
/// all predecessor values that reach this def. If @p LR is a subrange,
|
||||||
|
/// the array @p Undefs is the set of all locations where it is undefined
|
||||||
|
/// via <def,read-undef> in other subranges for the same register.
|
||||||
void extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
|
void extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
|
||||||
LiveRange &LR, ArrayRef<SlotIndex>);
|
LiveRange &LR, LaneBitmask LM,
|
||||||
|
ArrayRef<SlotIndex> Undefs);
|
||||||
|
|
||||||
/// extendPHIKillRanges - Extend the ranges of all values killed by original
|
/// extendPHIKillRanges - Extend the ranges of all values killed by original
|
||||||
/// parent PHIDefs.
|
/// parent PHIDefs.
|
||||||
|
Loading…
Reference in New Issue
Block a user