[PATCH] D102394: [LoopVectorize] Don't attempt to widen certain calls for scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 01:30:02 PDT 2021


david-arm added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1515
   /// variables found for the given VF.
-  bool canVectorizeReductions(ElementCount VF) {
+  bool canVectorizeReductions(ElementCount VF) const {
     return (all_of(Legal->getReductionVars(), [&](auto &Reduction) -> bool {
----------------
sdesmalen wrote:
> nit: is this an unrelated change?
No, it's needed because the caller is also marked `const`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5692-5699
+        for (auto &VFInfo : VFDatabase::getMappings(*CI)) {
+          if (VFInfo.Shape.IsScalable) {
+            HasScalableMapping = true;
+            break;
+          }
+        }
+
----------------
sdesmalen wrote:
> nit: Can you use `llvm::any_of()` instead of the above loop?
Sure. To be honest, in general I find the above loop more readable than using lambdas, which is why I tend to find it more natural to write code this way. However, I know lots of the codebase uses them. :)


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

https://reviews.llvm.org/D102394



More information about the llvm-commits mailing list