[llvm] r241449 - Fix a bug in the A57FPLoadBalancing register tracking/scavenger.

Chad Rosier mcrosier at codeaurora.org
Mon Jul 6 07:46:34 PDT 2015


Author: mcrosier
Date: Mon Jul  6 09:46:34 2015
New Revision: 241449

URL: http://llvm.org/viewvc/llvm-project?rev=241449&view=rev
Log:
Fix a bug in the A57FPLoadBalancing register tracking/scavenger.

The code in AArch64A57FPLoadBalancing::scavengeRegister() to handle dead defs
was not correctly handling aliased registers.  E.g. if the dead def was of D2,
then S2 was not being marked as unavailable, so it could potentially be used
across a live-range in which it would be clobbered.

Patch by Geoff Berry <gberry at codeaurora.org>!
Phabricator: http://reviews.llvm.org/D10900

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp?rev=241449&r1=241448&r2=241449&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp Mon Jul  6 09:46:34 2015
@@ -510,9 +510,17 @@ int AArch64A57FPLoadBalancing::scavengeR
       if (J.isRegMask())
         AvailableRegs.clearBitsNotInMask(J.getRegMask());
 
-      if (J.isReg() && J.isDef() && AvailableRegs[J.getReg()]) {
-        assert(J.isDead() && "Non-dead def should have been removed by now!");
-        AvailableRegs.reset(J.getReg());
+      if (J.isReg() && J.isDef()) {
+        MCRegAliasIterator AI(J.getReg(), TRI, /*IncludeSelf=*/true);
+        if (J.isDead())
+          for (; AI.isValid(); ++AI)
+            AvailableRegs.reset(*AI);
+#ifndef NDEBUG
+        else
+          for (; AI.isValid(); ++AI)
+            assert(!AvailableRegs[*AI] &&
+                   "Non-dead def should have been removed by now!");
+#endif
       }
     }
   }





More information about the llvm-commits mailing list