[clang-tools-extra] [libcxx] [mlir] [llvm] [clang] [flang] [LV] Improve AnyOf reduction codegen. (PR #78304)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 06:29:38 PST 2024
================
@@ -9110,6 +9111,41 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
continue;
const RecurrenceDescriptor &RdxDesc = PhiR->getRecurrenceDescriptor();
+ // Adjust AnyOf reductions; replace the reduction phi for the selected value
+ // with a boolean reduction phi node to check if the condition is true in
+ // any iteration. The final value is selected by the final
+ // ComputeReductionResult.
+ if (RecurrenceDescriptor::isAnyOfRecurrenceKind(
+ RdxDesc.getRecurrenceKind())) {
+ auto *Select = cast<VPRecipeBase>(*find_if(PhiR->users(), [](VPUser *U) {
+ return isa<VPWidenSelectRecipe>(U) ||
+ (isa<VPReplicateRecipe>(U) &&
+ cast<VPReplicateRecipe>(U)->getUnderlyingInstr()->getOpcode() ==
+ Instruction::Select);
+ }));
----------------
fhahn wrote:
`cast` should already assert to check for non-null.
https://github.com/llvm/llvm-project/pull/78304
More information about the llvm-commits
mailing list