[llvm-commits] [llvm] r64076 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/SimpleRegisterCoalescing.cpp
Evan Cheng
evan.cheng at apple.com
Sun Feb 8 00:24:28 PST 2009
Author: evancheng
Date: Sun Feb 8 02:24:28 2009
New Revision: 64076
URL: http://llvm.org/viewvc/llvm-project?rev=64076&view=rev
Log:
Strengthen the previous check.
Modified:
llvm/trunk/include/llvm/CodeGen/LiveInterval.h
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=64076&r1=64075&r2=64076&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Sun Feb 8 02:24:28 2009
@@ -272,17 +272,15 @@
return I != kills.end() && *I == KillIdx;
}
- /// isOnlyKill - Return true if the specified index is the only kill of the
- /// specified val#.
- static bool isOnlyKill(const VNInfo *VNI, unsigned KillIdx) {
- bool Found = false;
- const SmallVector<unsigned, 4> &kills = VNI->kills;
- for (unsigned i = 0, e = kills.size(); i != e; ++i) {
- if (KillIdx != kills[i])
+ /// isOnlyLROfValNo - Return true if the specified live range is the only
+ /// one defined by the its val#.
+ bool isOnlyLROfValNo( const LiveRange *LR) {
+ for (const_iterator I = begin(), E = end(); I != E; ++I) {
+ const LiveRange *Tmp = I;
+ if (Tmp != LR && Tmp->valno == LR->valno)
return false;
- Found = true;
}
- return Found;
+ return true;
}
/// MergeValueNumberInto - This method is called when two value nubmers
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=64076&r1=64075&r2=64076&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Sun Feb 8 02:24:28 2009
@@ -489,7 +489,7 @@
}
/// 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.
bool
SimpleRegisterCoalescing::TrimLiveIntervalToLastUse(unsigned CopyIdx,
@@ -867,9 +867,10 @@
if (LR->valno->def == RemoveStart) {
// If the def MI defines the val# and this copy is the only kill of the
// val#, then propagate the dead marker.
- if (!li.isOnlyKill(LR->valno, RemoveEnd))
- li.removeKill(LR->valno, RemoveEnd);
- else {
+ if (!li.isOnlyLROfValNo(LR)) {
+ if (li.isKill(LR->valno, RemoveEnd))
+ li.removeKill(LR->valno, RemoveEnd);
+ } else {
PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
++numDeadValNo;
}
More information about the llvm-commits
mailing list