Anti-dependency breaking needs to be careful not to use reserved regs
authorJim Grosbach <grosbach@apple.com>
Thu, 2 Sep 2010 17:12:55 +0000 (17:12 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 2 Sep 2010 17:12:55 +0000 (17:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112832 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AggressiveAntiDepBreaker.cpp
lib/CodeGen/CriticalAntiDepBreaker.cpp

index 62e40e9636bb33c3dc006516d9ffddaf8b307061..5a634d6ccb0182c02213b006df704d21e33b4373 100644 (file)
@@ -654,6 +654,8 @@ bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters(
     if (R == RB) R = RE;
     --R;
     const unsigned NewSuperReg = *R;
+    // Don't consider non-allocatable registers
+    if (!AllocatableSet.test(NewSuperReg)) continue;
     // Don't replace a register with itself.
     if (NewSuperReg == SuperReg) continue;
 
index 98d4d413201815d174864e32ca8178c6ed47c8cd..335d2d8e9bac7737bf2d9ca56aa985f38aba05d2 100644 (file)
@@ -330,6 +330,8 @@ CriticalAntiDepBreaker::findSuitableFreeRegister(MachineInstr *MI,
   for (TargetRegisterClass::iterator R = RC->allocation_order_begin(MF),
        RE = RC->allocation_order_end(MF); R != RE; ++R) {
     unsigned NewReg = *R;
+    // Don't consider non-allocatable registers
+    if (!AllocatableSet.test(NewReg)) continue;
     // Don't replace a register with itself.
     if (NewReg == AntiDepReg) continue;
     // Don't replace a register with one that was recently used to repair