[llvm-commits] [llvm] r47262 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Evan Cheng evan.cheng at apple.com
Mon Feb 18 00:40:53 PST 2008


Author: evancheng
Date: Mon Feb 18 02:40:53 2008
New Revision: 47262

URL: http://llvm.org/viewvc/llvm-project?rev=47262&view=rev
Log:
For now, avoid commuting def MI for copy MI's whose source is not killed. That simply trade a live interval for another and because only the non-two-address operands can be folded into loads, may end up pessimising code.

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

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=47262&r1=47261&r2=47262&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Feb 18 02:40:53 2008
@@ -247,6 +247,13 @@
 
   unsigned CopyIdx = li_->getDefIndex(li_->getInstructionIndex(CopyMI));
 
+  // FIXME: For now, only eliminate the copy by commuting its def is the source
+  // does not live pass the move. Coalescing those copies may end up may simply
+  // end up swapping a live interval for another. That and because usually only
+  // the non-two address operand can be folded can end up pessimizing the code.
+  if (CopyMI->findRegisterUseOperandIdx(IntA.reg, true) != -1)
+    return false;
+
   // BValNo is a value number in B that is defined by a copy from A. 'B3' in
   // the example above.
   LiveInterval::iterator BLR = IntB.FindLiveRangeContaining(CopyIdx);





More information about the llvm-commits mailing list