[llvm] [SLP]Cost-based choice of the i1 reduction form (PR #223163)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 03:40:08 PDT 2026


================
@@ -31866,8 +31871,17 @@ class HorizontalReduction {
             auto [RType, IsSigned] = R.getRootNodeTypeWithNoCast().value_or(
                 std::make_pair(RedTy, true));
             if (RType == RedTy) {
-              VectorCost = TTI->getArithmeticReductionCost(RdxOpcode, VectorTy,
-                                                           FMF, CostKind);
+              if (VectorTy->getElementType()->isIntegerTy(1) &&
+                  (RdxKind == RecurKind::And || RdxKind == RecurKind::Or ||
+                   (RdxKind == RecurKind::Add && !ScalarTy->isIntegerTy(1))))
----------------
arsenm wrote:

Braces 

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


More information about the llvm-commits mailing list