[PATCH] D10900: Fix a bug in the A57FPLoadBalancing register tracking/scavenger due to aliasing registers.

Chad Rosier mcrosier at codeaurora.org
Thu Jul 2 08:50:57 PDT 2015


mcrosier created this revision.
mcrosier added reviewers: jmolloy, t.p.northover.
mcrosier added a subscriber: llvm-commits-list.
mcrosier set the repository for this revision to rL LLVM.
Herald added a subscriber: aemerson.

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.

This is nearly impossible to test, so I haven't included a test case.

 Chad

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10900

Files:
  lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp

Index: lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
===================================================================
--- lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
+++ lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
@@ -510,9 +510,17 @@
       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
       }
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10900.28947.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150702/b4a4d6e8/attachment.bin>


More information about the llvm-commits mailing list