diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-29 17:37:29 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-29 17:37:29 +0000 |
| commit | dff6a6e4f17b2fcf94660b8697c15defb3178126 (patch) | |
| tree | 7395c67e6a55365d4350c1e541a07233c6dfc389 /llvm/lib/CodeGen/LiveInterval.cpp | |
| parent | 2cdca458613622182d29214455f92ef4ce998c38 (diff) | |
| download | llvm-dff6a6e4f17b2fcf94660b8697c15defb3178126.zip llvm-dff6a6e4f17b2fcf94660b8697c15defb3178126.tar.gz llvm-dff6a6e4f17b2fcf94660b8697c15defb3178126.tar.bz2 | |
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.
llvm-svn: 117670
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 27a572c..3c18017 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/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(); } |
