[PATCH] D125111: [SLP] Make reordering aware of external vectorizable scalar stores.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 08:15:16 PDT 2022


dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4094
+           "Different types should have been rejected by collectUserStores()");
+    Optional<int> Diff = getPointersDiff(
+        S2->getValueOperand()->getType(), S2->getPointerOperand(),
----------------
Just a quick point - I would recommend against calling getPointersDiff in the sort compare function. I believe std::sorts require a strict weak ordering, and some compilers (MSVC) will complain if they do not. It's also probably calling getPointersDiff more times than necessary, being O(NlogN) as opposed to the N-1 calls needed.

I think it should be possible to precompute all the offsets from the first pointer initially, and sort the offsets?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125111



More information about the llvm-commits mailing list