[llvm] [SystemZ] SLP reductions: cost functions of reductions and scalarization (PR #112491)
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 29 11:23:08 PST 2024
================
@@ -780,24 +780,28 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
InstructionCost getScalarizationOverhead(VectorType *InTy,
const APInt &DemandedElts,
bool Insert, bool Extract,
- TTI::TargetCostKind CostKind) {
+ TTI::TargetCostKind CostKind,
+ ArrayRef<Value *> VL = {}) {
/// FIXME: a bitfield is not a reasonable abstraction for talking about
/// which elements are needed from a scalable vector
if (isa<ScalableVectorType>(InTy))
return InstructionCost::getInvalid();
auto *Ty = cast<FixedVectorType>(InTy);
assert(DemandedElts.getBitWidth() == Ty->getNumElements() &&
+ (VL.empty() || VL.size() == Ty->getNumElements()) &&
"Vector size mismatch");
InstructionCost Cost = 0;
for (int i = 0, e = Ty->getNumElements(); i < e; ++i) {
if (!DemandedElts[i])
continue;
- if (Insert)
+ if (Insert) {
+ Value *InsertedVal = VL.size() ? VL[i] : nullptr;
----------------
JonPsson1 wrote:
ok, I wonder if this is part of the coding guidelines somewhere? It should be equivalent, right?
https://github.com/llvm/llvm-project/pull/112491
More information about the llvm-commits
mailing list