summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-29 17:37:29 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-29 17:37:29 +0000
commit6d309059a7d6257ddeb3b07e6c4b8b71cce2f707 (patch)
tree5c2b215b001dc0d8718cfd21d647e6913515f742 /lib/CodeGen/LiveInterval.cpp
parentc94fcb1507db5c043558f3f58d389e774bc2f71d (diff)
downloadllvm-6d309059a7d6257ddeb3b07e6c4b8b71cce2f707.tar.gz
llvm-6d309059a7d6257ddeb3b07e6c4b8b71cce2f707.tar.bz2
llvm-6d309059a7d6257ddeb3b07e6c4b8b71cce2f707.tar.xz
Teach ConnectedVNInfoEqClasses::Classify to deal with unused values.
We don't want unused values forming their own equivalence classes, so we lump them all together in one class, and then merge them with the class of the last used value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117670 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 27a572c0ea..3c18017f3f 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -740,11 +740,20 @@ unsigned ConnectedVNInfoEqClasses::Classify(const LiveInterval *LI) {
for (unsigned i = 0, e = LI->getNumValNums(); i != e; ++i)
eqClass_.push_back(i);
+ const VNInfo *used = 0, *unused = 0;
+
// Determine connections.
for (LiveInterval::const_vni_iterator I = LI->vni_begin(), E = LI->vni_end();
I != E; ++I) {
const VNInfo *VNI = *I;
- assert(!VNI->isUnused() && "Cannot handle unused values");
+ // Group all unused values into one class.
+ if (VNI->isUnused()) {
+ if (unused)
+ Connect(unused->id, VNI->id);
+ unused = VNI;
+ continue;
+ }
+ used = VNI;
if (VNI->isPHIDef()) {
const MachineBasicBlock *MBB = lis_.getMBBFromIndex(VNI->def);
assert(MBB && "Phi-def has no defining MBB");
@@ -762,6 +771,11 @@ unsigned ConnectedVNInfoEqClasses::Classify(const LiveInterval *LI) {
Connect(VNI->id, UVNI->id);
}
}
+
+ // Lump all the unused values in with the last used value.
+ if (used && unused)
+ Connect(used->id, unused->id);
+
return Renumber();
}