[PATCH] D30438: SplitKit: Correctly implement partial copies

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 19:57:44 PDT 2017


MatzeB marked 2 inline comments as done.
MatzeB added inline comments.


================
Comment at: lib/CodeGen/SplitKit.cpp:551
+        LaneMask & ~(TRI.getSubRegIndexLaneMask(BestCover));
+    while (LanesLeft.any()) {
+      unsigned BestIdx = 0;
----------------
kparzysz wrote:
> Is there any guarantee that this loop will actually terminate?  In other words, do we know that the set PossibleIndexes covers the lanes completely?
This specific loop only checks each subregister index once and will therefore terminate.

The later loop is repeated as we are able to remove bits from the lanemask. If we fail to find a subregister index that removes any of the bits we will end up in the `report_fatal_error()` cases.


================
Comment at: lib/CodeGen/SplitKit.cpp:572
+
+      if (BestIdx == 0)
+        report_fatal_error("Impossible to implement partial COPY");
----------------
kparzysz wrote:
> Would it make sense to add `|| BestCover <= 0`?
`BestCover <= 0` can happen and is fine (it just means the best we could find is an index that covers more unnecessary lanes that we already covered anyway, than lanes we haven't covered yet).


Repository:
  rL LLVM

https://reviews.llvm.org/D30438





More information about the llvm-commits mailing list