Remove physreg support from adjustCopiesBackFrom and removeCopyByCommutingDef.

After physreg coalescing was disabled, these functions can't do anything
useful with physregs anyway.

llvm-svn: 157849
This commit is contained in:
Jakob Stoklund Olesen 2012-06-01 22:38:19 +00:00
parent 9b09cf0c11
commit ca487d2183
1 changed files with 3 additions and 29 deletions

View File

@ -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);