@@ -9388,17 +9388,15 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
9388
9388
auto *FinalReductionResult = new VPInstruction (
9389
9389
VPInstruction::ComputeReductionResult, {PhiR, NewExitingVPV}, ExitDL);
9390
9390
FinalReductionResult->insertBefore (*MiddleVPBB, IP);
9391
+ auto *FinalReductionResult = new VPInstruction (
9392
+ VPInstruction::ComputeReductionResult, {PhiR, NewExitingVPV}, ExitDL);
9393
+ // Update all users outside the vector region.
9391
9394
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 ();
9401
9398
});
9399
+ FinalReductionResult->insertBefore (*MiddleVPBB, IP);
9402
9400
}
9403
9401
9404
9402
VPlanTransforms::clearReductionWrapFlags (*Plan);
0 commit comments