================
@@ -17591,6 +17610,19 @@ BoUpSLP::getEntryCost(const TreeEntry *E, 
ArrayRef<Value *> VectorizedVals,
               Instruction::Load, VecTy, LI0->getAlign(),
               LI0->getPointerAddressSpace(), CostKind,
               TTI::getOperandInfo(LI0->getPointerOperand()));
+          // The vector load of a bundle saves nothing over scalar loads the
+          // target coalesces as well. A reduction that loses its fmas pays
+          // that saving back.
+          if (E->ReuseShuffleIndices.empty() && E->ReorderIndices.empty() &&
+              It == MinBWs.end() &&
+              reductionLosesFMAs(RdxKind, RdxFMF, VectorizedVals)) {
+            Align BestAlign = LI0->getAlign();
+            for (Value *V : VL)
+              BestAlign = std::max(BestAlign, cast<LoadInst>(V)->getAlign());
+            VecLdCost += TTI->getLoadCoalescingSaving(
+                LI0->getType(), VL.size(), BestAlign,
+                LI0->getPointerAddressSpace(), CostKind);
+          }
----------------
alexey-bataev wrote:

> and if you don't mind I'd like to have an order of patches looking like: fix 
> SLP -> fix TTI -> adjust SLP if necessary because not only SLP will be 
> affected

What's wrong with SLP, that you want to fix in 1st step? 

https://github.com/llvm/llvm-project/pull/228903
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to