From: Jakob Stoklund Olesen Date: Fri, 1 Jun 2012 22:38:19 +0000 (+0000) Subject: Remove physreg support from adjustCopiesBackFrom and removeCopyByCommutingDef. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0984461dfb329c8e43ca70e264f56cd39bbae573;p=oota-llvm.git Remove physreg support from adjustCopiesBackFrom and removeCopyByCommutingDef. After physreg coalescing was disabled, these functions can't do anything useful with physregs anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157849 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index db117ed1a09..2a535322198 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -396,6 +396,7 @@ void RegisterCoalescer::LRE_WillEraseInstruction(MachineInstr *MI) { bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP, MachineInstr *CopyMI) { assert(!CP.isPartial() && "This doesn't work for partial copies."); + assert(!CP.isPhys() && "This doesn't work for physreg copies."); // Bail if there is no dst interval - can happen when merging physical subreg // operations. @@ -450,20 +451,6 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP, // IntB, we can merge them. if (ValLR+1 != BLR) return false; - // If a live interval is a physical register, conservatively check if any - // of its aliases is overlapping the live interval of the virtual register. - // If so, do not coalesce. - if (TargetRegisterInfo::isPhysicalRegister(IntB.reg)) { - for (const uint16_t *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS) - if (LIS->hasInterval(*AS) && IntA.overlaps(LIS->getInterval(*AS))) { - DEBUG({ - dbgs() << "\t\tInterfere with alias "; - LIS->getInterval(*AS).print(dbgs(), TRI); - }); - return false; - } - } - DEBUG({ dbgs() << "Extending: "; IntB.print(dbgs(), TRI); @@ -576,12 +563,7 @@ bool RegisterCoalescer::hasOtherReachingDefs(LiveInterval &IntA, /// bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP, MachineInstr *CopyMI) { - // FIXME: For now, only eliminate the copy by commuting its def when the - // source register is a virtual register. We want to guard against cases - // where the copy is a back edge copy and commuting the def lengthen the - // live interval of the source register to the entire loop. - if (CP.isPhys() && CP.isFlipped()) - return false; + assert (!CP.isPhys()); // Bail if there is no dst interval. if (!LIS->hasInterval(CP.getDstReg())) @@ -642,14 +624,6 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP, if (hasOtherReachingDefs(IntA, IntB, AValNo, BValNo)) return false; - // Abort if the aliases of IntB.reg have values that are not simply the - // clobbers from the superreg. - if (TargetRegisterInfo::isPhysicalRegister(IntB.reg)) - for (const uint16_t *AS = TRI->getAliasSet(IntB.reg); *AS; ++AS) - if (LIS->hasInterval(*AS) && - hasOtherReachingDefs(IntA, LIS->getInterval(*AS), AValNo, 0)) - return false; - // If some of the uses of IntA.reg is already coalesced away, return false. // It's not possible to determine whether it's safe to perform the coalescing. for (MachineRegisterInfo::use_nodbg_iterator UI = @@ -1064,7 +1038,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { return true; // If we can eliminate the copy without merging the live ranges, do so now. - if (!CP.isPartial()) { + if (!CP.isPartial() && !CP.isPhys()) { if (adjustCopiesBackFrom(CP, CopyMI) || removeCopyByCommutingDef(CP, CopyMI)) { LIS->RemoveMachineInstrFromMaps(CopyMI);