[clang] [llvm] [LV] Mask off possibly aliasing vector lanes (PR #100579)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 09:30:44 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c7a3346ab6a8fbd551a80bd4028ec8624daa35e4 2a351ed7ee51d58dc9abc398ea57f68800791194 --extensions h,c,cpp -- clang/test/CodeGen/loop-alias-mask.c llvm/include/llvm/Analysis/LoopAccessAnalysis.h llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index 00dea303d4..1a6a01cf74 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -363,7 +363,8 @@ public:
   /// loop iteration.
   std::optional<VectorizationFactor>
   plan(ElementCount UserVF, unsigned UserIC,
-       std::optional<ArrayRef<PointerDiffInfo>> DiffChecks, std::function<Value*(const SCEV *)> Expander, bool &HasAliasMask);
+       std::optional<ArrayRef<PointerDiffInfo>> DiffChecks,
+       std::function<Value *(const SCEV *)> Expander, bool &HasAliasMask);
 
   /// Use the VPlan-native path to plan how to best vectorize, return the best
   /// VF and its cost.
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 5d0bcf2fba..70de45188d 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6904,10 +6904,10 @@ LoopVectorizationPlanner::planInVPlanNativePath(ElementCount UserVF) {
   return VectorizationFactor::Disabled();
 }
 
-std::optional<VectorizationFactor>
-LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC,
-                               std::optional<ArrayRef<PointerDiffInfo>> RTChecks,
-                               std::function<Value*(const SCEV*)> Expander, bool &HasAliasMask) {
+std::optional<VectorizationFactor> LoopVectorizationPlanner::plan(
+    ElementCount UserVF, unsigned UserIC,
+    std::optional<ArrayRef<PointerDiffInfo>> RTChecks,
+    std::function<Value *(const SCEV *)> Expander, bool &HasAliasMask) {
   assert(OrigLoop->isInnermost() && "Inner loop expected.");
   CM.collectValuesToIgnore();
   CM.collectElementTypesForWidening();
@@ -6919,8 +6919,7 @@ LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC,
   // VPlan needs the aliasing pointers as Values and not SCEVs, so expand them
   // here and put them into a list.
   SmallVector<PointerDiffInfoValues> DiffChecksValues;
-  if (RTChecks.has_value()
-      && useActiveLaneMask(CM.getTailFoldingStyle(true))) {
+  if (RTChecks.has_value() && useActiveLaneMask(CM.getTailFoldingStyle(true))) {
     for (auto Check : *RTChecks) {
       Value *Sink = Expander(Check.SinkStart);
       Value *Src = Expander(Check.SrcStart);
@@ -9921,10 +9920,13 @@ bool LoopVectorizePass::processLoop(Loop *L) {
 
   // Plan how to best vectorize, return the best VF and its cost.
   auto Expand = [&Checks, &L](const SCEV *S) {
-    return Checks.expandCodeForMemCheck(S, L->getLoopPreheader()->getTerminator());
+    return Checks.expandCodeForMemCheck(S,
+                                        L->getLoopPreheader()->getTerminator());
   };
   std::optional<VectorizationFactor> MaybeVF =
-      LVP.plan(UserVF, UserIC, LVL.getLAI()->getRuntimePointerChecking()->getDiffChecks(), Expand, Checks.HasAliasMask);
+      LVP.plan(UserVF, UserIC,
+               LVL.getLAI()->getRuntimePointerChecking()->getDiffChecks(),
+               Expand, Checks.HasAliasMask);
 
   VectorizationFactor VF = VectorizationFactor::Disabled();
   unsigned IC = 1;

``````````

</details>


https://github.com/llvm/llvm-project/pull/100579


More information about the cfe-commits mailing list