diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-26 22:33:12 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-26 22:33:12 +0000 |
commit | eef2327360e090c3867f423d762830bdf5aa207f (patch) | |
tree | 71d0c2d449e110f7792d01cfa154b992dc31c60e /llvm/lib/CodeGen/SplitKit.cpp | |
parent | 32dc9bd1bb1f3c439f7c8cd34eef062c1825442f (diff) | |
download | llvm-eef2327360e090c3867f423d762830bdf5aa207f.zip llvm-eef2327360e090c3867f423d762830bdf5aa207f.tar.gz llvm-eef2327360e090c3867f423d762830bdf5aa207f.tar.bz2 |
Add a safe-guard against repeated splitting for some rare cases.
The number of blocks covered by a live range must be strictly decreasing when
splitting, otherwise we can't allow repeated splitting.
llvm-svn: 130249
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index c6e1bd5..427ef94 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -221,6 +221,29 @@ bool SplitAnalysis::calcLiveBlockInfo() { return true; } +unsigned SplitAnalysis::countLiveBlocks(const LiveInterval *cli) const { + if (cli->empty()) + return 0; + LiveInterval *li = const_cast<LiveInterval*>(cli); + LiveInterval::iterator LVI = li->begin(); + LiveInterval::iterator LVE = li->end(); + unsigned Count = 0; + + // Loop over basic blocks where li is live. + MachineFunction::const_iterator MFI = LIS.getMBBFromIndex(LVI->start); + SlotIndex Stop = LIS.getMBBEndIdx(MFI); + for (;;) { + ++Count; + LVI = li->advanceTo(LVI, Stop); + if (LVI == LVE) + return Count; + do { + ++MFI; + Stop = LIS.getMBBEndIdx(MFI); + } while (Stop <= LVI->start); + } +} + bool SplitAnalysis::isOriginalEndpoint(SlotIndex Idx) const { unsigned OrigReg = VRM.getOriginal(CurLI->reg); const LiveInterval &Orig = LIS.getInterval(OrigReg); |