[llvm] 54c6e1c - [SLP] Move a non-power-of-two bailout down slightly

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 14:33:53 PDT 2024


Author: Philip Reames
Date: 2024-09-11T14:33:45-07:00
New Revision: 54c6e1c3f51758469cc06cbcc2ad28af210fc004

URL: https://github.com/llvm/llvm-project/commit/54c6e1c3f51758469cc06cbcc2ad28af210fc004
DIFF: https://github.com/llvm/llvm-project/commit/54c6e1c3f51758469cc06cbcc2ad28af210fc004.diff

LOG: [SLP] Move a non-power-of-two bailout down slightly

The first part of CheckForShuffledLoads isn't doing any subvector
analysis, so it's perfectly safe for arbitrary VL.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index c89a50fc7bd429..00d9f2909d71e2 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4819,12 +4819,6 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
   // representation is better than just gather.
   auto CheckForShuffledLoads = [&, &TTI = *TTI](Align CommonAlignment,
                                                 bool ProfitableGatherPointers) {
-    // FIXME: The following code has not been updated for non-power-of-2
-    // vectors.  The splitting logic here does not cover the original
-    // vector if the vector factor is not a power of two.  FIXME
-    if (!has_single_bit(VL.size()))
-      return false;
-
     // Compare masked gather cost and loads + insert subvector costs.
     TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
     auto [ScalarGEPCost, VectorGEPCost] =
@@ -4874,6 +4868,13 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
     constexpr unsigned ListLimit = 4;
     if (!TryRecursiveCheck || VL.size() < ListLimit)
       return MaskedGatherCost - GatherCost >= -SLPCostThreshold;
+
+    // FIXME: The following code has not been updated for non-power-of-2
+    // vectors.  The splitting logic here does not cover the original
+    // vector if the vector factor is not a power of two.  FIXME
+    if (!has_single_bit(VL.size()))
+      return false;
+
     unsigned Sz = DL->getTypeSizeInBits(ScalarTy);
     unsigned MinVF = getMinVF(2 * Sz);
     DemandedElts.clearAllBits();


        


More information about the llvm-commits mailing list