[PATCH] D144491: [VPlan] Use isUniformAfterVec in VPReplicateRecipe::execute.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 16:12:43 PDT 2023


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9612
+  if (isa<StoreInst>(UI) &&
+      vputils::isUniformAfterVectorization(getOperand(1))) {
     auto Lane = VPLane::getLastLaneForVF(State.VF);
----------------
Ayal wrote:
> Ayal wrote:
> > This is a bit fragile considering that isUniformAfterVectorization() in general also represents lane-varying values whose first lane need only be used, as in vector stores - see `isUniformDecision `.
> This patch is fine - effectively considering Replicate recipe invariants as "uniform addresses" in addition to current isLiveIns (aka !hasDefiningRecipe).
> 
> Above comment (independent of this patch) refers to vputils which introduced "onlyFirstLaneUsed" to handle the "AfterVectorization" part, and its isUniformAfterVectorization() should be renamed isUniform(). In fact, it currently checks isInvariant(), i.e., same value across all loop iterations. This could be improved to "uniform" - same value across lanes (per part) as in D148841, and possibly also to same value across lanes*parts (per vectorized iteration) - but the latter refers to UF.
Also, regarding isUniform - in addition to recipe-less LiveIns and uniform Replicate recipes, uniform values may also be provided by non-Replicate recipes placed in vec/pre-headers and by WidenGEP recipe (though broadcasted into a vector).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144491



More information about the llvm-commits mailing list