[RDF] Add registers to live set even if they are live already

When calculating kills, a register may be considered live because a part
of it is live, but if there is a use of that (whole) register, the whole
register (and its subregisters) need to be added to the live set.

llvm-svn: 292845
This commit is contained in:
Krzysztof Parzyszek 2017-01-23 23:03:49 +00:00
parent 0f550c8176
commit 09a8638724
1 changed files with 5 additions and 6 deletions

View File

@ -377,9 +377,9 @@ void Liveness::computePhiInfo() {
NodeAddr<UseNode*> A = DFG.addr<UseNode*>(UN); NodeAddr<UseNode*> A = DFG.addr<UseNode*>(UN);
uint16_t F = A.Addr->getFlags(); uint16_t F = A.Addr->getFlags();
if ((F & (NodeAttrs::Undef | NodeAttrs::PhiRef)) == 0) { if ((F & (NodeAttrs::Undef | NodeAttrs::PhiRef)) == 0) {
RegisterRef R = DFG.normalizeRef(getRestrictedRegRef(A)); RegisterRef R = DFG.normalizeRef(getRestrictedRegRef(A));
RealUses[R.Reg].insert({A.Id,R.Mask}); RealUses[R.Reg].insert({A.Id,R.Mask});
} }
UN = A.Addr->getSibling(); UN = A.Addr->getSibling();
} }
// Visit all reached defs, and add them to the queue. These defs may // Visit all reached defs, and add them to the queue. These defs may
@ -424,7 +424,7 @@ void Liveness::computePhiInfo() {
auto UA = DFG.addr<UseNode*>(I->first); auto UA = DFG.addr<UseNode*>(I->first);
// Undef flag is checked above. // Undef flag is checked above.
assert((UA.Addr->getFlags() & NodeAttrs::Undef) == 0); assert((UA.Addr->getFlags() & NodeAttrs::Undef) == 0);
RegisterRef R(UI->first, I->second); RegisterRef R(UI->first, I->second);
NodeList RDs = getAllReachingDefs(R, UA); NodeList RDs = getAllReachingDefs(R, UA);
if (any_of(RDs, InPhiDefs)) if (any_of(RDs, InPhiDefs))
++I; ++I;
@ -803,9 +803,8 @@ void Liveness::resetKills(MachineBasicBlock *B) {
IsLive = true; IsLive = true;
break; break;
} }
if (IsLive) if (!IsLive)
continue; Op.setIsKill(true);
Op.setIsKill(true);
for (MCSubRegIterator SR(R, &TRI, true); SR.isValid(); ++SR) for (MCSubRegIterator SR(R, &TRI, true); SR.isValid(); ++SR)
Live.set(*SR); Live.set(*SR);
} }