summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterCoalescer.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-06-01 22:38:19 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-06-01 22:38:19 +0000
commit0984461dfb329c8e43ca70e264f56cd39bbae573 (patch)
tree8b49a489bc1a1737f86cb7ec1ebc0a47383c710b /lib/CodeGen/RegisterCoalescer.cpp
parent8c70ea47fae6d61441d150cbe9431cf5e06222e5 (diff)
downloadllvm-0984461dfb329c8e43ca70e264f56cd39bbae573.tar.gz
llvm-0984461dfb329c8e43ca70e264f56cd39bbae573.tar.bz2
llvm-0984461dfb329c8e43ca70e264f56cd39bbae573.tar.xz
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
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r--lib/CodeGen/RegisterCoalescer.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp
index db117ed1a0..2a53532219 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);