[PATCH] D20627: Do not rename registers that do not start an independent live range

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 16:04:03 PDT 2016


kparzysz added a comment.

The node PathSU is the def in the use->def anti-dependency.  AntiDepReg is the register causing that anti-dependency.  The code goes over all successors of PathSU to see if any of them are dependent on a register that is "larger" than AntiDepReg.  I think this is what your suggestion is.


================
Comment at: lib/CodeGen/AggressiveAntiDepBreaker.cpp:907-909
@@ +906,5 @@
+          // the larger register.
+          BitVector Aliases(TRI->getNumRegs());
+          for (MCRegAliasIterator AI(AntiDepReg, TRI, true); AI.isValid(); ++AI)
+            Aliases.set(*AI);
+          for (SDep S : PathSU->Succs) {
----------------
MatzeB wrote:
> This seems expensive. I would at least move the `Aliases` variable out of the loop and simply clear it so the we do not need to allocate the memory again each iteration.
Sure, I can do that.

================
Comment at: lib/CodeGen/AggressiveAntiDepBreaker.cpp:917-918
@@ +916,4 @@
+              continue;
+            if (R == AntiDepReg || TRI->isSubRegister(AntiDepReg, R))
+              continue;
+            AntiDepReg = 0;
----------------
MatzeB wrote:
> Isn't the `R == AntiDepReg || TRI->isSubRegister(AntiDepReg, R)` redundant after checking the Aliases bitset you construct here?
In the failing case, AntiDepReg is R23, which is a subregister of D11.  This loop goes over the successors of the def of R23: if all successors are either dependent on R23 or any subregister of R23, they are fine, because the def of R23 will cover them.  Only if any of them depends on an alias of R23 that is not contained within R23 (such as D11, for example), the loop resets the anti-dep register and prevents renaming.
The check is really "if (R is not contained within AntiDepReg) and (R is aliased to AntiDepReg), then don't rename".


Repository:
  rL LLVM

http://reviews.llvm.org/D20627





More information about the llvm-commits mailing list