[llvm] [SLP]Fix/improve potential masked gather loads analysis. (PR #83472)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 04:12:15 PST 2024


================
@@ -4100,14 +4100,15 @@ static LoadsState canVectorizeLoads(ArrayRef<Value *> VL, const Value *VL0,
     // increases the cost.
     Loop *L = LI.getLoopFor(cast<LoadInst>(VL0)->getParent());
     bool ProfitableGatherPointers =
-        static_cast<unsigned>(count_if(
-            PointerOps,
-            [L](Value *V) { return L && L->isLoopInvariant(V); })) <= Sz / 2 &&
+        L &&
+        count_if(PointerOps, [L](Value *V) { return L->isLoopInvariant(V); }) <=
+            Sz / 2 &&
         Sz > 2;
----------------
RKSimon wrote:

Worth moving the Sz > 2 earlier so we avoid the count_if entirely if unnecessary?

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


More information about the llvm-commits mailing list