Check regmask interference for -join-physregs.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 13 Feb 2012 18:17:04 +0000 (18:17 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 13 Feb 2012 18:17:04 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150404 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegisterCoalescer.cpp

index 2144137e634ab066f1e1b7cb7be0c009195662c7..61dcec2eab948ff8e8580abfc3301abc1b00f4af 100644 (file)
@@ -1426,6 +1426,14 @@ bool RegisterCoalescer::JoinIntervals(CoalescerPair &CP) {
       return true;
     }
 
+    // Check if a register mask clobbers DstReg.
+    BitVector UsableRegs;
+    if (LIS->checkRegMaskInterference(RHS, UsableRegs) &&
+        !UsableRegs.test(CP.getDstReg())) {
+      DEBUG(dbgs() << "\t\tRegister mask interference.\n");
+      return false;
+    }
+
     for (const unsigned *AS = TRI->getAliasSet(CP.getDstReg()); *AS; ++AS){
       if (!LIS->hasInterval(*AS))
         continue;