[llvm] [SLP]Allow bitcast/bswap based reductions for types, larger than the total strided size (PR #184018)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 10:57:35 PST 2026


================
@@ -15830,12 +15830,19 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
       InstructionCost BitcastCost = TTI.getCastInstrCost(
           Instruction::BitCast, ScalarTy, SrcVecTy, CastCtx, CostKind);
       if (ShuffleOrOp == TreeEntry::ReducedBitcastBSwap) {
-        auto *OrigScalarTy = E->getMainOp()->getType();
+        auto *OrigScalarTy = IntegerType::getIntNTy(
+            ScalarTy->getContext(),
+            DL->getTypeSizeInBits(SrcScalarTy) * EntryVF);
----------------
bababuck wrote:

Nit: Naming consistency is off I think. Below, you used:
```
      auto *SrcType = IntegerType::get(
          Op->getContext(),
          DL->getTypeSizeInBits(cast<CastInst>(ZExt->getMainOp())->getSrcTy()) *
              E->getVectorFactor());
      auto *OrigScalarTy = ScalarTy;
```

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


More information about the llvm-commits mailing list