File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -4280,7 +4280,24 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
42804280 switch (VPI->getOpcode ()) {
42814281 // Selects are not modelled in the legacy cost model if they are
42824282 // inserted for reductions.
4283- case Instruction::Select:
4283+ case Instruction::Select: {
4284+ VPValue *V =
4285+ R.getNumDefinedValues () == 1 ? R.getVPSingleValue () : nullptr ;
4286+ if (V && V->getNumUsers () == 1 ) {
4287+ if (auto *UR = dyn_cast<VPWidenRecipe>(*V->user_begin ())) {
4288+ switch (UR->getOpcode ()) {
4289+ case Instruction::UDiv:
4290+ case Instruction::SDiv:
4291+ case Instruction::URem:
4292+ case Instruction::SRem:
4293+ continue ;
4294+ default :
4295+ break ;
4296+ }
4297+ }
4298+ }
4299+ [[fallthrough]];
4300+ }
42844301 case VPInstruction::ActiveLaneMask:
42854302 case VPInstruction::ExplicitVectorLength:
42864303 C += VPI->cost (VF, CostCtx);
You can’t perform that action at this time.
0 commit comments