diff options
author | Matthias Braun <matze@braunis.de> | 2014-12-10 01:12:40 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2014-12-10 01:12:40 +0000 |
commit | 2079aa914062f0ff151e22dcbc28b4c8367e934a (patch) | |
tree | d978cbd8d98c6b1eafed7c3e7fd77ce067317cb0 /llvm/lib/CodeGen/LiveInterval.cpp | |
parent | 8970d847c49426c504be0e6c2a66bfb5c096faf6 (diff) | |
download | bcm5719-llvm-2079aa914062f0ff151e22dcbc28b4c8367e934a.tar.gz bcm5719-llvm-2079aa914062f0ff151e22dcbc28b4c8367e934a.zip |
LiveInterval: Add removeEmptySubRanges().
llvm-svn: 223887
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 5162579adf1..5d1b99400b7 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -592,6 +592,23 @@ VNInfo *LiveRange::MergeValueNumberInto(VNInfo *V1, VNInfo *V2) { return V2; } +void LiveInterval::removeEmptySubRanges() { + SubRange **NextPtr = &SubRanges; + SubRange *I = *NextPtr; + while (I != nullptr) { + if (!I->empty()) { + NextPtr = &I->Next; + I = *NextPtr; + continue; + } + // Skip empty subranges until we find the first nonempty one. + do { + I = I->Next; + } while (I != nullptr && I->empty()); + *NextPtr = I; + } +} + unsigned LiveInterval::getSize() const { unsigned Sum = 0; for (const_iterator I = begin(), E = end(); I != E; ++I) |