aboutsummaryrefslogtreecommitdiffstats
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
commit37743896699e67b66e1a457678aa024e680e9125 (patch)
treef64bfb1e2c14fbc56563823c57940a77f0023e11
parent3b448202073804bf68fc9c0eaf40be1064e94bb4 (diff)
downloadexternal_llvm-37743896699e67b66e1a457678aa024e680e9125.zip
external_llvm-37743896699e67b66e1a457678aa024e680e9125.tar.gz
external_llvm-37743896699e67b66e1a457678aa024e680e9125.tar.bz2
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47262 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 17a8908..199c89e 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/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);