aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-18 01:06:19 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-18 01:06:19 +0000
commitdfe3b6d2a9a452f2fd748416cd8e4c2583e0e8c5 (patch)
treedee4127d09fd88c857b2cfafc67d83d18b657399
parentbb1744ec1531fff3fd22fdfcd65f0f72d99c4fa5 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122123 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SplitKit.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index f371be1e10..4bb13e44b8 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/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.