Clear preference when it no longer makes sense.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 9 Sep 2008 21:44:23 +0000 (21:44 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 9 Sep 2008 21:44:23 +0000 (21:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56019 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SimpleRegisterCoalescing.cpp

index 6805c8d41c80af5e6ff8e661dc30ca8f00deb3bb..5a386dde068a221929406fa8e6abb9cc83b79956 100644 (file)
@@ -1317,6 +1317,14 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
     }
   }
 
+  // If resulting interval has a preference that no longer fits because of subreg
+  // coalescing, just clear the preference.
+  if (ResDstInt->preference && (isExtSubReg || isInsSubReg)) {
+    const TargetRegisterClass *RC = mri_->getRegClass(ResDstInt->reg);
+    if (!RC->contains(ResDstInt->preference))
+      ResDstInt->preference = 0;
+  }
+
   DOUT << "\n\t\tJoined.  Result = "; ResDstInt->print(DOUT, tri_);
   DOUT << "\n";