[llvm] [ExpandReductions] Add support for non-pow2 vector counts (PR #208738)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 03:38:40 PDT 2026


================
@@ -127,6 +149,10 @@ bool expandReductions(Function &F, const TargetTransformInfo *TTI,
         break;
       }
       unsigned RdxOpcode = getArithmeticReductionInstruction(ID);
+      if (!isPowerOf2_32(NumElts)) {
----------------
arsenm wrote:

Why not just fix getShuffleReduction to naturally handle the odd case instead of requiring pre-guarding every use 

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


More information about the llvm-commits mailing list