Help testing.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 21 Feb 2008 19:20:21 +0000 (19:20 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 21 Feb 2008 19:20:21 +0000 (19:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47448 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SimpleRegisterCoalescing.cpp

index 7c512ed368a8669d088ceb64c8daa984987caf96..86c9895ca92a276d384e9eb519fd34cd2235f986 100644 (file)
@@ -57,6 +57,10 @@ namespace {
   CommuteDef("coalescer-commute-instrs",
              cl::init(false), cl::Hidden);
 
+  static cl::opt<int>
+  CommuteLimit("commute-limit",
+               cl::init(-1), cl::Hidden);
+
   RegisterPass<SimpleRegisterCoalescing> 
   X("simple-register-coalescing", "Simple Register Coalescing");
 
@@ -289,6 +293,9 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
   if (HasOtherReachingDefs(IntA, IntB, AValNo, BValNo))
     return false;
 
+  if (CommuteLimit >= 0 && numCommutes >= CommuteLimit)
+    return false;
+
   // At this point we have decided that it is legal to do this
   // transformation.  Start by commuting the instruction.
   MachineBasicBlock *MBB = DefMI->getParent();