[llvm-commits] [llvm] r147719 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp

Evan Cheng evan.cheng at apple.com
Fri Jan 6 19:35:48 PST 2012


Author: evancheng
Date: Fri Jan  6 21:35:48 2012
New Revision: 147719

URL: http://llvm.org/viewvc/llvm-project?rev=147719&view=rev
Log:
Revert part of r147716. Looks like x87 instructions kill markers are all messed
up so branch folding pass can't use the scavenger. :-(  This doesn't breaks
anything currently. It just means targets which do not carefully update kill
markers cannot run post-ra scheduler (not new, it has always been the case).

We should fix this at some point since it's really hacky.

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

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=147719&r1=147718&r2=147719&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Fri Jan  6 21:35:48 2012
@@ -180,7 +180,7 @@
   TRI = tri;
   MMI = mmi;
 
-  RS = new RegScavenger();
+  RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : NULL;
 
   // Fix CFG.  The later algorithms expect it to be right.
   bool MadeChange = false;
@@ -368,14 +368,16 @@
 
 void BranchFolder::MaintainLiveIns(MachineBasicBlock *CurMBB,
                                    MachineBasicBlock *NewMBB) {
-  RS->enterBasicBlock(CurMBB);
-  if (!CurMBB->empty())
-    RS->forward(prior(CurMBB->end()));
-  BitVector RegsLiveAtExit(TRI->getNumRegs());
-  RS->getRegsUsed(RegsLiveAtExit, false);
-  for (unsigned int i = 0, e = TRI->getNumRegs(); i != e; i++)
-    if (RegsLiveAtExit[i])
-      NewMBB->addLiveIn(i);
+  if (RS) {
+    RS->enterBasicBlock(CurMBB);
+    if (!CurMBB->empty())
+      RS->forward(prior(CurMBB->end()));
+    BitVector RegsLiveAtExit(TRI->getNumRegs());
+    RS->getRegsUsed(RegsLiveAtExit, false);
+    for (unsigned int i = 0, e = TRI->getNumRegs(); i != e; i++)
+      if (RegsLiveAtExit[i])
+        NewMBB->addLiveIn(i);
+  }
 }
 
 /// ReplaceTailWithBranchTo - Delete the instruction OldInst and everything





More information about the llvm-commits mailing list