[llvm] [VPlan] Replace PhiR operand of ComputeAnyOfResult with VPIRFlags. (PR #175657)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 18 02:06:11 PST 2026


================
@@ -8762,17 +8762,29 @@ void LoopVectorizationPlanner::addReductionResultComputation(
     VPBuilder::InsertPointGuard Guard(Builder);
     Builder.setInsertPoint(MiddleVPBB, IP);
     RecurKind RecurrenceKind = PhiR->getRecurrenceKind();
+    // For AnyOf reductions, find the select among PhiR's users. This is used
+    // both to find NewVal for ComputeAnyOfResult and to adjust the reduction.
+    VPRecipeBase *AnyOfSelect = nullptr;
+    if (RecurrenceDescriptor::isAnyOfRecurrenceKind(RecurrenceKind)) {
+      AnyOfSelect = cast<VPRecipeBase>(*find_if(PhiR->users(), [](VPUser *U) {
----------------
ayalz wrote:

This retains the current behavior of defining `Select`, but would it be better to use `PhiR->getBackedgeValue()` (asserting it's a select), aka `OrigExitingVPV`, instead?

https://github.com/llvm/llvm-project/pull/175657


More information about the llvm-commits mailing list