From: Evan Cheng Date: Fri, 23 Jan 2009 05:48:59 +0000 (+0000) Subject: Only check if coalescing is worthwhile when the result is targeting a more restrictiv... X-Git-Tag: android-x86-6.0-r1~1003^2~23050 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c16d37ead0f07cc250d06e5cdbb3836f2f6082cd;p=android-x86%2Fexternal-llvm.git 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 --- diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index f0b0d58d135..f3ffc69cccb 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.