Create subranges for new intervals resulting from live interval splitting
The register allocator can split a live interval of a register into a set of smaller intervals. After the allocation of registers is complete, the rewriter will modify the IR to replace virtual registers with the corres- ponding physical registers. At this stage, if a register corresponding to a subregister of a virtual register is used, the rewriter will check if that subregister is undefined, and if so, it will add the <undef> flag to the machine operand. The function verifying liveness of the subregis- ter would assume that it is undefined, unless any of the subranges of the live interval proves otherwise. The problem is that the live intervals created during splitting do not have any subranges, even if the original parent interval did. This could result in the <undef> flag placed on a register that is actually defined. Differential Revision: http://reviews.llvm.org/D21189 llvm-svn: 279625
This commit is contained in:
@@ -1813,18 +1813,25 @@ void MachineVerifier::verifyLiveRangeSegment(const LiveRange &LR,
|
||||
bool hasRead = false;
|
||||
bool hasSubRegDef = false;
|
||||
bool hasDeadDef = false;
|
||||
LaneBitmask RLM = MRI->getMaxLaneMaskForVReg(Reg);
|
||||
for (ConstMIBundleOperands MOI(*MI); MOI.isValid(); ++MOI) {
|
||||
if (!MOI->isReg() || MOI->getReg() != Reg)
|
||||
continue;
|
||||
if (LaneMask != 0 &&
|
||||
(LaneMask & TRI->getSubRegIndexLaneMask(MOI->getSubReg())) == 0)
|
||||
continue;
|
||||
unsigned Sub = MOI->getSubReg();
|
||||
LaneBitmask SLM = Sub != 0 ? TRI->getSubRegIndexLaneMask(Sub) : RLM;
|
||||
if (MOI->isDef()) {
|
||||
if (MOI->getSubReg() != 0)
|
||||
if (Sub != 0) {
|
||||
hasSubRegDef = true;
|
||||
// An operand vreg0:sub0<def> reads vreg0:sub1..n. Invert the lane
|
||||
// mask for subregister defs. Read-undef defs will be handled by
|
||||
// readsReg below.
|
||||
SLM = ~SLM & RLM;
|
||||
}
|
||||
if (MOI->isDead())
|
||||
hasDeadDef = true;
|
||||
}
|
||||
if (LaneMask != 0 && !(LaneMask & SLM))
|
||||
continue;
|
||||
if (MOI->readsReg())
|
||||
hasRead = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user