aboutsummaryrefslogtreecommitdiffstats
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
commitc212aa822cf9a01eb1b190e3fcdb62b327303ec1 (patch)
tree533d3ace8f1a8aa6623852c1393360c6d190fc61 /lib/CodeGen/SimpleRegisterCoalescing.cpp
parent5ed30619a81949a67a637afee64ed8c80f2a1e62 (diff)
downloadexternal_llvm-c212aa822cf9a01eb1b190e3fcdb62b327303ec1.tar.gz
external_llvm-c212aa822cf9a01eb1b190e3fcdb62b327303ec1.tar.bz2
external_llvm-c212aa822cf9a01eb1b190e3fcdb62b327303ec1.zip
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.