Skip to content

Commit 0821107

Browse files
Mel-Chenfhahn
andcommitted
Update llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Refine the update lambda of ComputeReductionResult. Co-authored-by: Florian Hahn <[email protected]>
1 parent fec4ac2 commit 0821107

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9388,17 +9388,15 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
93889388
auto *FinalReductionResult = new VPInstruction(
93899389
VPInstruction::ComputeReductionResult, {PhiR, NewExitingVPV}, ExitDL);
93909390
FinalReductionResult->insertBefore(*MiddleVPBB, IP);
9391+
auto *FinalReductionResult = new VPInstruction(
9392+
VPInstruction::ComputeReductionResult, {PhiR, NewExitingVPV}, ExitDL);
9393+
// Update all users outside the vector region.
93919394
OrigExitingVPV->replaceUsesWithIf(
9392-
FinalReductionResult, [IntermediateStore](VPUser &User, unsigned) {
9393-
return match(&User, m_Binary<VPInstruction::ExtractFromEnd>(
9394-
m_VPValue(), m_VPValue())) ||
9395-
(isa<VPReplicateRecipe>(&User) &&
9396-
cast<VPReplicateRecipe>(&User)->getUnderlyingValue() ==
9397-
IntermediateStore &&
9398-
cast<VPReplicateRecipe>(&User)
9399-
->getOperand(1)
9400-
->isDefinedOutsideVectorRegions());
9395+
FinalReductionResult, [](VPUser &User, unsigned) {
9396+
auto *Parent = cast<VPRecipeBase>(&User)->getParent();
9397+
return Parent && !Parent->getParent();
94019398
});
9399+
FinalReductionResult->insertBefore(*MiddleVPBB, IP);
94029400
}
94039401

94049402
VPlanTransforms::clearReductionWrapFlags(*Plan);

0 commit comments

Comments
 (0)