[PATCH] D50665: [LV][LAA] Vectorize loop invariant values stored into loop invariant address

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 13:53:42 PDT 2018


Ayal added a comment.

The decision how to vectorize invariant stores also deserves attention: `LoopVectorizationCostModel::setCostBasedWideningDecision()` considers loads from uniform addresses, but not invariant stores - these may end up being scalarized or becoming a scatter; the former is preferred in this case, as the identical scalarized replicas can later be removed. In any case associated cost estimates should be provided to support overall vectorization costs. Note that vectorizing **conditional** invariant stores deserves special attention. Unconditional invariant stores are candidates to be sunk out of the loop, preferably before trying to vectorize it. One approach to vectorize a conditional invariant store is to check if its mask is all false, and if not to perform a single invariant scalar store, for lack of a masked-scalar-store instruction. May be worth distinguishing between uniform and divergent conditions; this check is easier to carry out in the former case.



================
Comment at: include/llvm/Analysis/LoopAccessAnalysis.h:570
   /// else returns false.
   bool hasStoreToLoopInvariantAddress() const {
     return StoreToLoopInvariantAddress;
----------------
This becomes dead?


================
Comment at: include/llvm/Analysis/LoopAccessAnalysis.h:578
+    return StoreToLoopInvariantAddress &&
+           NonVectorizableStoreToLoopInvariantAddress;
+  }
----------------
AND both indicators?


Repository:
  rL LLVM

https://reviews.llvm.org/D50665





More information about the llvm-commits mailing list