diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-27 00:39:07 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-27 00:39:07 +0000 |
| commit | 79e1407c11106432af54040764782421f7933c86 (patch) | |
| tree | 3b931cc7659ede3f89235852f01e025aeb941692 /llvm/lib/CodeGen | |
| parent | 795ed981808402f8ce91d15f3dcf3bc3510ad557 (diff) | |
| download | bcm5719-llvm-79e1407c11106432af54040764782421f7933c86.tar.gz bcm5719-llvm-79e1407c11106432af54040764782421f7933c86.zip | |
Handle critical loop predecessors by making both inside and outside registers
live out.
This doesn't prevent us from inserting a loop preheader later on, if that is
better.
llvm-svn: 117424
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 15 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SplitKit.h | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index cf297568f6d..a89a977695f 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -512,7 +512,7 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx, // extendTo - Find the last li_ value defined in MBB at or before Idx. The // parentli_ is assumed to be live at Idx. Extend the live range to Idx. // Return the found VNInfo, or NULL. -VNInfo *LiveIntervalMap::extendTo(MachineBasicBlock *MBB, SlotIndex Idx) { +VNInfo *LiveIntervalMap::extendTo(const MachineBasicBlock *MBB, SlotIndex Idx) { assert(li_ && "call reset first"); LiveInterval::iterator I = std::upper_bound(li_->begin(), li_->end(), Idx); if (I == li_->begin()) @@ -861,6 +861,16 @@ void SplitEditor::computeRemainder() { dupli_.addSimpleRange(LR.start, LR.end, LR.valno); } } + + // Extend dupli_ to be live out of any critical loop predecessors. + // This means we have multiple registers live out of those blocks. + // The alternative would be to split the critical edges. + if (criticalPreds_.empty()) + return; + for (SplitAnalysis::BlockPtrSet::iterator I = criticalPreds_.begin(), + E = criticalPreds_.end(); I != E; ++I) + dupli_.extendTo(*I, lis_.getMBBEndIdx(*I).getPrevSlot()); + criticalPreds_.clear(); } void SplitEditor::finish() { @@ -924,6 +934,9 @@ void SplitEditor::splitAroundLoop(const MachineLoop *Loop) { sa_.getCriticalExits(Blocks, CriticalExits); assert(CriticalExits.empty() && "Cannot break critical exits yet"); + // Get critical predecessors so computeRemainder can deal with them. + sa_.getCriticalPreds(Blocks, criticalPreds_); + // Create new live interval for the loop. openIntv(); diff --git a/llvm/lib/CodeGen/SplitKit.h b/llvm/lib/CodeGen/SplitKit.h index 08fac7f451d..9c109dc4d5f 100644 --- a/llvm/lib/CodeGen/SplitKit.h +++ b/llvm/lib/CodeGen/SplitKit.h @@ -200,7 +200,7 @@ public: // extendTo - Find the last li_ value defined in MBB at or before Idx. The // parentli is assumed to be live at Idx. Extend the live range to include // Idx. Return the found VNInfo, or NULL. - VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx); + VNInfo *extendTo(const MachineBasicBlock *MBB, SlotIndex Idx); /// isMapped - Return true is ParentVNI is a known mapped value. It may be a /// simple 1-1 mapping or a complex mapping to later defs. @@ -271,6 +271,10 @@ class SplitEditor { /// truncating any overlap with intervals_. void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI); + /// criticalPreds_ - Set of basic blocks where both dupli and openli should be + /// live out because of a critical edge. + SplitAnalysis::BlockPtrSet criticalPreds_; + /// computeRemainder - Compute the dupli liveness as the complement of all the /// new intervals. void computeRemainder(); |

