aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SimpleRegisterCoalescing.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-01-23 05:48:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-01-23 05:48:59 +0000
commitc16d37ead0f07cc250d06e5cdbb3836f2f6082cd (patch)
tree533d3ace8f1a8aa6623852c1393360c6d190fc61 /lib/CodeGen/SimpleRegisterCoalescing.cpp
parent3e2351fa2a2b937935f953cd441aac78680a3562 (diff)
Only check if coalescing is worthwhile when the result is targeting a more restrictive register class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index f0b0d58d13..f3ffc69ccc 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -1290,8 +1290,13 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
}
}
+ // If we are joining two virtual registers and the resulting register
+ // class is more restrictive (fewer register, smaller size). Check if it's
+ // worth doing the merge.
if (!SrcIsPhys && !DstIsPhys &&
- !isWinToJoinCrossClass(LargeReg, SmallReg, Limit)) {
+ (isExtSubReg || DstRC->isASubClass()) &&
+ !isWinToJoinCrossClass(LargeReg, SmallReg,
+ allocatableRCRegs_[NewRC].count())) {
DOUT << "\tSrc/Dest are different register classes.\n";
// Allow the coalescer to try again in case either side gets coalesced to
// a physical register that's compatible with the other side. e.g.