[llvm-commits] [llvm] r122123 - /llvm/trunk/lib/CodeGen/SplitKit.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Dec 17 17:06:19 PST 2010


Author: stoklund
Date: Fri Dec 17 19:06:19 2010
New Revision: 122123

URL: http://llvm.org/viewvc/llvm-project?rev=122123&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/SplitKit.cpp

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=122123&r1=122122&r2=122123&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Fri Dec 17 19:06:19 2010
@@ -1077,11 +1077,13 @@
   // 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.





More information about the llvm-commits mailing list