@@ -8046,11 +8046,11 @@ bool VPRecipeBuilder::getScaledReductions(
8046
8046
BinaryOperator *ExtendUser = dyn_cast<BinaryOperator>(Op);
8047
8047
std::optional<unsigned > BinOpc;
8048
8048
Type *ExtOpTypes[2 ] = {nullptr };
8049
+ TTI::PartialReductionExtendKind ExtKinds[2 ] = {TTI::PR_None};
8049
8050
8050
- auto CollectExtInfo = [this , &Exts,
8051
- &ExtOpTypes](SmallVectorImpl<Value *> &Ops) -> bool {
8052
- unsigned I = 0 ;
8053
- for (Value *OpI : Ops) {
8051
+ auto CollectExtInfo = [this , &Exts, &ExtOpTypes,
8052
+ &ExtKinds](SmallVectorImpl<Value *> &Ops) -> bool {
8053
+ for (const auto &[I, OpI] : enumerate(Ops)) {
8054
8054
Value *ExtOp;
8055
8055
if (!match (OpI, m_ZExtOrSExt (m_Value (ExtOp))))
8056
8056
return false ;
@@ -8061,7 +8061,7 @@ bool VPRecipeBuilder::getScaledReductions(
8061
8061
return false ;
8062
8062
8063
8063
ExtOpTypes[I] = ExtOp->getType ();
8064
- I++ ;
8064
+ ExtKinds[I] = TTI::getPartialReductionExtendKind (Exts[I]) ;
8065
8065
}
8066
8066
return true ;
8067
8067
};
@@ -8090,10 +8090,6 @@ bool VPRecipeBuilder::getScaledReductions(
8090
8090
} else
8091
8091
return false ;
8092
8092
8093
- TTI::PartialReductionExtendKind OpAExtend =
8094
- TTI::getPartialReductionExtendKind (Exts[0 ]);
8095
- TTI::PartialReductionExtendKind OpBExtend =
8096
- Exts[1 ] ? TTI::getPartialReductionExtendKind (Exts[1 ]) : TTI::PR_None;
8097
8093
PartialReductionChain Chain (RdxExitInstr, Exts[0 ], Exts[1 ], ExtendUser);
8098
8094
8099
8095
TypeSize PHISize = PHI->getType ()->getPrimitiveSizeInBits ();
@@ -8106,7 +8102,8 @@ bool VPRecipeBuilder::getScaledReductions(
8106
8102
[&](ElementCount VF) {
8107
8103
InstructionCost Cost = TTI->getPartialReductionCost (
8108
8104
Update->getOpcode (), ExtOpTypes[0 ], ExtOpTypes[1 ],
8109
- PHI->getType (), VF, OpAExtend, OpBExtend, BinOpc, CM.CostKind );
8105
+ PHI->getType (), VF, ExtKinds[0 ], ExtKinds[1 ], BinOpc,
8106
+ CM.CostKind );
8110
8107
return Cost.isValid ();
8111
8108
},
8112
8109
Range)) {
0 commit comments