[flang] [mlir] [clang-tools-extra] [clang] [libcxx] [llvm] [LV] Improve AnyOf reduction codegen. (PR #78304)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 31 03:22:26 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);
+ }));
----------------
ayalz wrote:
nit: assert(Select && "a meaningful error message");
https://github.com/llvm/llvm-project/pull/78304
More information about the cfe-commits
mailing list