aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-05-20 23:25:36 +0000
committerCameron Zwarich <zwarich@apple.com>2011-05-20 23:25:36 +0000
commit345968c82d73d7b770a377d91ecea53c4672d48b (patch)
tree070c87ebac8642e787adce25d018cd227031dac7
parent43299776d7cae9843b354b9fcc08186437516d68 (diff)
downloadexternal_llvm-345968c82d73d7b770a377d91ecea53c4672d48b.zip
external_llvm-345968c82d73d7b770a377d91ecea53c4672d48b.tar.gz
external_llvm-345968c82d73d7b770a377d91ecea53c4672d48b.tar.bz2
Fix PR9962 by properly constraining register classes in RemoveCopyByCommutingDef(). This
actually fixes most of the VerifyCoalescing failures in test-suite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131768 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index c33ce24..2118489 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -430,6 +430,10 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(const CoalescerPair &CP,
MachineInstr *NewMI = tii_->commuteInstruction(DefMI);
if (!NewMI)
return false;
+ if (TargetRegisterInfo::isVirtualRegister(IntA.reg) &&
+ TargetRegisterInfo::isVirtualRegister(IntB.reg) &&
+ !mri_->constrainRegClass(IntB.reg, mri_->getRegClass(IntA.reg)))
+ return false;
if (NewMI != DefMI) {
li_->ReplaceMachineInstrInMaps(DefMI, NewMI);
MBB->insert(DefMI, NewMI);