LiveInterval: Introduce createMainRangeFromSubranges().

This function constructs the main liverange by merging all subranges if
subregister liveness tracking is available. This should be slightly
faster to compute instead of performing the liveness calculation again
for the main range. More importantly it avoids cases where the main
liverange would cover positions where no subrange was live. These cases
happened for partial definitions where the actual defined part was dead
and only the undefined parts used later.

The register coalescing requires that every part covered by the main
live range has at least one subrange live.

I also expect this function to become usefull later for places where the
subranges are modified in a way that it is hard to correctly fix the
main liverange in the machine scheduler, we can simply reconstruct it
from subranges then.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224806 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun
2014-12-24 02:11:51 +00:00
parent 02add3f1a6
commit 8882414a11
3 changed files with 234 additions and 7 deletions

View File

@@ -552,6 +552,10 @@ namespace llvm {
void verify() const;
#endif
protected:
/// Append a segment to the list of segments.
void append(const LiveRange::Segment S);
private:
iterator addSegmentFrom(Segment S, iterator From);
@@ -685,6 +689,10 @@ namespace llvm {
/// are not considered valid and should only exist temporarily).
void removeEmptySubRanges();
/// Construct main live range by merging the SubRanges of @p LI.
void constructMainRangeFromSubranges(const SlotIndexes &Indexes,
VNInfo::Allocator &VNIAllocator);
/// getSize - Returns the sum of sizes of all the LiveRange's.
///
unsigned getSize() const;