diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-18 01:06:19 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-18 01:06:19 +0000 |
| commit | 7971a3eaffed4c4f0848350c16f56651678a4cfa (patch) | |
| tree | eca5485f2a9ddfb342f6f9ba0ef9cc855b1cb7d2 /llvm/lib/CodeGen/SplitKit.cpp | |
| parent | 1d108cb962744deba11c0def9f42770c8687b995 (diff) | |
| download | bcm5719-llvm-7971a3eaffed4c4f0848350c16f56651678a4cfa.tar.gz bcm5719-llvm-7971a3eaffed4c4f0848350c16f56651678a4cfa.zip | |
Check that the register is live-in to the loop header before inserting copies in
the loop predecessors.
The register can be live-out from a predecessor without being live-in to the
loop header if there is a critical edge from the predecessor.
llvm-svn: 122123
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index f371be1e106..4bb13e44b80 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -1077,11 +1077,13 @@ void SplitEditor::splitAroundLoop(const MachineLoop *Loop) { // Create new live interval for the loop. openIntv(); - // Insert copies in the predecessors. - for (SplitAnalysis::BlockPtrSet::iterator I = Blocks.Preds.begin(), - E = Blocks.Preds.end(); I != E; ++I) { - MachineBasicBlock &MBB = const_cast<MachineBasicBlock&>(**I); - enterIntvAtEnd(MBB); + // Insert copies in the predecessors if live-in to the header. + if (lis_.isLiveInToMBB(edit_.getParent(), Loop->getHeader())) { + for (SplitAnalysis::BlockPtrSet::iterator I = Blocks.Preds.begin(), + E = Blocks.Preds.end(); I != E; ++I) { + MachineBasicBlock &MBB = const_cast<MachineBasicBlock&>(**I); + enterIntvAtEnd(MBB); + } } // Switch all loop blocks. |

