RegisterCoalescer::reMaterializeTrivialDef() can constrain the destination
authorCameron Zwarich <zwarich@apple.com>
Thu, 14 Feb 2013 03:25:24 +0000 (03:25 +0000)
committerCameron Zwarich <zwarich@apple.com>
Thu, 14 Feb 2013 03:25:24 +0000 (03:25 +0000)
register class to match the defining instruction.

llvm-svn: 175130

llvm/lib/CodeGen/RegisterCoalescer.cpp

index 07ae8a2..e2488ad 100644 (file)
@@ -769,7 +769,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(CoalescerPair &CP,
     // extract_subreg, insert_subreg, subreg_to_reg coalescing.
     const TargetRegisterClass *RC = TII->getRegClass(MCID, 0, TRI, *MF);
     if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
-      if (MRI->getRegClass(DstReg) != RC)
+      if (!MRI->constrainRegClass(DstReg, RC))
         return false;
     } else if (!RC->contains(DstReg))
       return false;