Strengthen the previous check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2009-02-08 08:24:28 +00:00
parent f18134a1ae
commit 86fb9fdb20
2 changed files with 12 additions and 13 deletions

View File

@ -272,17 +272,15 @@ namespace llvm {
return I != kills.end() && *I == KillIdx; return I != kills.end() && *I == KillIdx;
} }
/// isOnlyKill - Return true if the specified index is the only kill of the /// isOnlyLROfValNo - Return true if the specified live range is the only
/// specified val#. /// one defined by the its val#.
static bool isOnlyKill(const VNInfo *VNI, unsigned KillIdx) { bool isOnlyLROfValNo( const LiveRange *LR) {
bool Found = false; for (const_iterator I = begin(), E = end(); I != E; ++I) {
const SmallVector<unsigned, 4> &kills = VNI->kills; const LiveRange *Tmp = I;
for (unsigned i = 0, e = kills.size(); i != e; ++i) { if (Tmp != LR && Tmp->valno == LR->valno)
if (KillIdx != kills[i])
return false; return false;
Found = true;
} }
return Found; return true;
} }
/// MergeValueNumberInto - This method is called when two value nubmers /// MergeValueNumberInto - This method is called when two value nubmers

View File

@ -489,7 +489,7 @@ static void removeRange(LiveInterval &li, unsigned Start, unsigned End,
} }
/// TrimLiveIntervalToLastUse - If there is a last use in the same basic block /// TrimLiveIntervalToLastUse - If there is a last use in the same basic block
/// as the copy instruction, trim the ive interval to the last use and return /// as the copy instruction, trim the live interval to the last use and return
/// true. /// true.
bool bool
SimpleRegisterCoalescing::TrimLiveIntervalToLastUse(unsigned CopyIdx, SimpleRegisterCoalescing::TrimLiveIntervalToLastUse(unsigned CopyIdx,
@ -867,9 +867,10 @@ SimpleRegisterCoalescing::ShortenDeadCopySrcLiveRange(LiveInterval &li,
if (LR->valno->def == RemoveStart) { if (LR->valno->def == RemoveStart) {
// If the def MI defines the val# and this copy is the only kill of the // If the def MI defines the val# and this copy is the only kill of the
// val#, then propagate the dead marker. // val#, then propagate the dead marker.
if (!li.isOnlyKill(LR->valno, RemoveEnd)) if (!li.isOnlyLROfValNo(LR)) {
li.removeKill(LR->valno, RemoveEnd); if (li.isKill(LR->valno, RemoveEnd))
else { li.removeKill(LR->valno, RemoveEnd);
} else {
PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_); PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
++numDeadValNo; ++numDeadValNo;
} }