File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -329,9 +329,12 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
329329 // recipe.
330330 auto HandleWiden = [&](VPWidenRecipe *Widen) {
331331 if (match (Widen, m_Sub (m_ZeroInt (), m_VPValue (Op)))) {
332- Widen = dyn_cast<VPWidenRecipe>(Op->getDefiningRecipe ());
333- if (!Widen)
332+ Widen = dyn_cast<VPWidenRecipe>(Op);
333+ if (!Widen) {
334+ assert (Op->isLiveIn () &&
335+ " Operand must either be a VPWidenRecipe or a live-in" );
334336 return ;
337+ }
335338 }
336339 Opcode = Widen->getOpcode ();
337340 VPRecipeBase *ExtAR = Widen->getOperand (0 )->getDefiningRecipe ();
@@ -362,9 +365,10 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
362365 ExtAType = GetExtendKind (RedPhiOp1R);
363366 } else if (auto Widen = dyn_cast_if_present<VPWidenRecipe>(RedPhiOp1R))
364367 HandleWiden (Widen);
365- } else if (auto Widen = dyn_cast <VPWidenRecipe>(OpR)) {
368+ } else if (auto Widen = dyn_cast_if_present <VPWidenRecipe>(OpR)) {
366369 HandleWiden (Widen);
367- } else if (auto Reduction = dyn_cast<VPPartialReductionRecipe>(OpR)) {
370+ } else if (auto Reduction =
371+ dyn_cast_if_present<VPPartialReductionRecipe>(OpR)) {
368372 return Reduction->computeCost (VF, Ctx);
369373 }
370374 auto *PhiType = Ctx.Types .inferScalarType (getOperand (1 ));
You can’t perform that action at this time.
0 commit comments