summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-10 01:12:36 +0000
committerMatthias Braun <matze@braunis.de>2014-12-10 01:12:36 +0000
commit8970d847c49426c504be0e6c2a66bfb5c096faf6 (patch)
treecc34e1030b6588a78d0f3b234a1dedbe8e20c913 /llvm/lib/CodeGen
parent630e42e1762ab2b618597c036a05113117354f15 (diff)
downloadbcm5719-llvm-8970d847c49426c504be0e6c2a66bfb5c096faf6.tar.gz
bcm5719-llvm-8970d847c49426c504be0e6c2a66bfb5c096faf6.zip
LiveIntervalAnalysis: Add subregister aware variants pruneValue().
llvm-svn: 223886
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp30
-rw-r--r--llvm/lib/CodeGen/RegisterCoalescer.cpp4
2 files changed, 22 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 77e7149c713..dde55f9dd48 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -542,26 +542,25 @@ void LiveIntervals::extendToIndices(LiveRange &LR,
LRCalc->extend(LR, Indices[i]);
}
-void LiveIntervals::pruneValue(LiveInterval *LI, SlotIndex Kill,
+void LiveIntervals::pruneValue(LiveRange &LR, SlotIndex Kill,
SmallVectorImpl<SlotIndex> *EndPoints) {
- LiveQueryResult LRQ = LI->Query(Kill);
- VNInfo *VNI = LRQ.valueOut();
+ LiveQueryResult LRQ = LR.Query(Kill);
+ VNInfo *VNI = LRQ.valueOutOrDead();
if (!VNI)
return;
MachineBasicBlock *KillMBB = Indexes->getMBBFromIndex(Kill);
- SlotIndex MBBStart, MBBEnd;
- std::tie(MBBStart, MBBEnd) = Indexes->getMBBRange(KillMBB);
+ SlotIndex MBBEnd = Indexes->getMBBEndIdx(KillMBB);
// If VNI isn't live out from KillMBB, the value is trivially pruned.
if (LRQ.endPoint() < MBBEnd) {
- LI->removeSegment(Kill, LRQ.endPoint());
+ LR.removeSegment(Kill, LRQ.endPoint());
if (EndPoints) EndPoints->push_back(LRQ.endPoint());
return;
}
// VNI is live out of KillMBB.
- LI->removeSegment(Kill, MBBEnd);
+ LR.removeSegment(Kill, MBBEnd);
if (EndPoints) EndPoints->push_back(MBBEnd);
// Find all blocks that are reachable from KillMBB without leaving VNI's live
@@ -578,8 +577,9 @@ void LiveIntervals::pruneValue(LiveInterval *LI, SlotIndex Kill,
MachineBasicBlock *MBB = *I;
// Check if VNI is live in to MBB.
+ SlotIndex MBBStart, MBBEnd;
std::tie(MBBStart, MBBEnd) = Indexes->getMBBRange(MBB);
- LiveQueryResult LRQ = LI->Query(MBBStart);
+ LiveQueryResult LRQ = LR.Query(MBBStart);
if (LRQ.valueIn() != VNI) {
// This block isn't part of the VNI segment. Prune the search.
I.skipChildren();
@@ -588,20 +588,30 @@ void LiveIntervals::pruneValue(LiveInterval *LI, SlotIndex Kill,
// Prune the search if VNI is killed in MBB.
if (LRQ.endPoint() < MBBEnd) {
- LI->removeSegment(MBBStart, LRQ.endPoint());
+ LR.removeSegment(MBBStart, LRQ.endPoint());
if (EndPoints) EndPoints->push_back(LRQ.endPoint());
I.skipChildren();
continue;
}
// VNI is live through MBB.
- LI->removeSegment(MBBStart, MBBEnd);
+ LR.removeSegment(MBBStart, MBBEnd);
if (EndPoints) EndPoints->push_back(MBBEnd);
++I;
}
}
}
+void LiveIntervals::pruneValue(LiveInterval &LI, SlotIndex Kill,
+ SmallVectorImpl<SlotIndex> *EndPoints) {
+ pruneValue((LiveRange&)LI, Kill, EndPoints);
+
+ for (LiveInterval::subrange_iterator SR = LI.subrange_begin(),
+ SE = LI.subrange_end(); SR != SE; ++SR) {
+ pruneValue(*SR, Kill, nullptr);
+ }
+}
+
//===----------------------------------------------------------------------===//
// Register allocator hooks.
//
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index ec40656e4f0..12f4978de24 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -1917,7 +1917,7 @@ void JoinVals::pruneValues(JoinVals &Other,
break;
case CR_Replace: {
// This value takes precedence over the value in Other.LI.
- LIS->pruneValue(&Other.LI, Def, &EndPoints);
+ LIS->pruneValue(Other.LI, Def, &EndPoints);
// Check if we're replacing an IMPLICIT_DEF value. The IMPLICIT_DEF
// instructions are only inserted to provide a live-out value for PHI
// predecessors, so the instruction should simply go away once its value
@@ -1951,7 +1951,7 @@ void JoinVals::pruneValues(JoinVals &Other,
// We can no longer trust the value mapping computed by
// computeAssignment(), the value that was originally copied could have
// been replaced.
- LIS->pruneValue(&LI, Def, &EndPoints);
+ LIS->pruneValue(LI, Def, &EndPoints);
DEBUG(dbgs() << "\t\tpruned all of " << PrintReg(LI.reg) << " at "
<< Def << ": " << LI << '\n');
}
OpenPOWER on IntegriCloud