aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-08-14 23:19:28 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-08-14 23:19:28 +0000
commitdc5294fd83147ebbea9390a3aeb78fe398c05308 (patch)
tree3b884d1271897a9b4be7f73dc15a7627f3148233 /lib
parentc91f0b80687f0a6fafa5a5e6cd87498e2de6fc3e (diff)
downloadexternal_llvm-dc5294fd83147ebbea9390a3aeb78fe398c05308.zip
external_llvm-dc5294fd83147ebbea9390a3aeb78fe398c05308.tar.gz
external_llvm-dc5294fd83147ebbea9390a3aeb78fe398c05308.tar.bz2
Fix for PR1596: AdjustCopiesBackFrom() should conservatively check if any of its sub-registers may overlap with the interval of the copy that's being coalesced.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index fc88ffe..93fb350 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -125,6 +125,19 @@ bool SimpleRegisterCoalescing::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInte
// live-range starts. If there are no intervening live ranges between them in
// 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 sub-registers is overlapping the live interval of the virtual
+ // register. If so, do not coalesce.
+ if (MRegisterInfo::isPhysicalRegister(IntB.reg) &&
+ *mri_->getSubRegisters(IntB.reg)) {
+ for (const unsigned* SR = mri_->getSubRegisters(IntB.reg); *SR; ++SR)
+ if (li_->hasInterval(*SR) && IntA.overlaps(li_->getInterval(*SR))) {
+ DOUT << "Interfere with sub-register ";
+ DEBUG(li_->getInterval(*SR).print(DOUT, mri_));
+ return false;
+ }
+ }
DOUT << "\nExtending: "; IntB.print(DOUT, mri_);