Skip to content

Commit 5f14165

Browse files
committed
Simplify utility function
1 parent b905806 commit 5f14165

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,14 +4877,10 @@ void LoopVectorizationCostModel::collectElementTypesForWidening() {
48774877
/// Get the VF scaling factor applied to the recipe's output, if the recipe has
48784878
/// one.
48794879
static unsigned getVFScaleFactor(VPRecipeBase *R) {
4880-
if (isa<VPPartialReductionRecipe, VPReductionPHIRecipe>(R)) {
4881-
auto *ReductionR = dyn_cast<VPReductionPHIRecipe>(R);
4882-
auto *PartialReductionR =
4883-
ReductionR ? nullptr : dyn_cast<VPPartialReductionRecipe>(R);
4884-
unsigned ScaleFactor = ReductionR ? ReductionR->getVFScaleFactor()
4885-
: PartialReductionR->getVFScaleFactor();
4886-
return ScaleFactor;
4887-
}
4880+
if (auto *RR = dyn_cast<VPReductionPHIRecipe>(R))
4881+
return RR->getVFScaleFactor();
4882+
if (auto *RR = dyn_cast<VPPartialReductionRecipe>(R))
4883+
return RR->getVFScaleFactor();
48884884
return 1;
48894885
}
48904886

0 commit comments

Comments
 (0)