Only check if coalescing is worthwhile when the result is targeting a more restrictive register class.

llvm-svn: 62837
This commit is contained in:
Evan Cheng 2009-01-23 05:48:59 +00:00
parent 4a5296ec5f
commit 8ef6b2d75e

View File

@ -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.