Skip to content

Commit 4f66f4f

Browse files
committed
Improve inloop reduction detection
1 parent c36c8f6 commit 4f66f4f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5026,18 +5026,18 @@ calculateRegisterUsage(VPlan &Plan, ArrayRef<ElementCount> VFs,
50265026
if (isa<VPVectorPointerRecipe, VPVectorEndPointerRecipe,
50275027
VPBranchOnMaskRecipe>(R))
50285028
continue;
5029-
/// In-loop reductions don't carry their output across iterations.
5030-
if (auto *Phi = dyn_cast<VPReductionPHIRecipe>(R);
5031-
Phi && Phi->isInLoop())
5032-
continue;
50335029

50345030
if (VFs[J].isScalar() ||
50355031
isa<VPCanonicalIVPHIRecipe, VPReplicateRecipe, VPDerivedIVRecipe,
50365032
VPScalarIVStepsRecipe>(R) ||
50375033
(isa<VPInstruction>(R) &&
5038-
all_of(cast<VPSingleDefRecipe>(R)->users(), [&](VPUser *U) {
5039-
return cast<VPRecipeBase>(U)->usesScalars(R->getVPSingleValue());
5040-
}))) {
5034+
all_of(cast<VPSingleDefRecipe>(R)->users(),
5035+
[&](VPUser *U) {
5036+
return cast<VPRecipeBase>(U)->usesScalars(
5037+
R->getVPSingleValue());
5038+
})) ||
5039+
(isa<VPReductionPHIRecipe>(R) &&
5040+
(cast<VPReductionPHIRecipe>(R))->isInLoop())) {
50415041
unsigned ClassID = TTI.getRegisterClassForType(
50425042
false, TypeInfo.inferScalarType(R->getVPSingleValue()));
50435043
// FIXME: The target might use more than one register for the type

0 commit comments

Comments
 (0)