summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-18 08:40:53 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-18 08:40:53 +0000
commit8f90724a5334cfe5d1039cab3d0b7ad9b59aef7f (patch)
tree4f7a6f31b35c98dbe7fb03e8aeec4df57cfd159b /llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
parent6b39cb907b91fcb7e620c54c7384b44294e93c13 (diff)
downloadbcm5719-llvm-8f90724a5334cfe5d1039cab3d0b7ad9b59aef7f.tar.gz
bcm5719-llvm-8f90724a5334cfe5d1039cab3d0b7ad9b59aef7f.zip
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.
llvm-svn: 47262
Diffstat (limited to 'llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r--llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 17a89086bb6..199c89ef55a 100644
--- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -247,6 +247,13 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
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);
OpenPOWER on IntegriCloud