[PATCH] D98967: [Analysis]Add getPointersDiff function to improve compile time.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 23 06:22:36 PDT 2021


ABataev added a comment.

In D98967#2643717 <https://reviews.llvm.org/D98967#2643717>, @lebedev.ri wrote:

> Can `isConsecutiveAccess()` be reimplemented in terms of `getPointersDiff()` now?

Sure, I'll rework `isConsecutiveAccess()` to use `getPointersDiff()`

> LGTM, but someone else should take a look, too.
> Nice, https://llvm-compile-time-tracker.com/compare.php?from=bde995c9c2a0f73c69f1ca60b94bec0bebf20537&to=de67ba4218b6a64361e0269624a6998acb493b51&stat=instructions





================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:1206
+  };
+  std::set<DistOrdPair, decltype(Compare)> Offsets(Compare);
+  Offsets.emplace(0, 0);
----------------
lebedev.ri wrote:
> Why is this no longer `llvm::SmallSet<>`?
Well, I thought that it is going to be more optimal to use `std::set` here directly. For `SmallSet` we cannot pass comparer directly (but this can be fixed, I think), for the small number of elements it uses `SmallVector` with linear search and if growth too big it switches to `std::set`, copying all the elements from the SmallVector. I think that here we can use `std::set` directly to avoid extra copying in case of the increasing number of elements and linear search for the small number of elements.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:945-946
+      if (LI1 && LI2) {
+        if (LI1->getParent() != LI2->getParent())
+          return VLOperands::ScoreFail;
+
----------------
lebedev.ri wrote:
> This looks like a separate change.
Well, in general, yes but this also improves compile time as we do not need to get pointers diff in this case and we can return `ScoreFail` immediately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98967/new/

https://reviews.llvm.org/D98967



More information about the llvm-commits mailing list