[llvm] [LV] Keep predicate select when optimizeFindIVReductions when folding tail. (PR #191166)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 18:53:19 PDT 2026
================
@@ -5880,6 +5880,15 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
continue;
}
+ // When tail folding, mask the condition with the header mask to prevent
+ // propagating poison from inactive lanes in the last vector iteration.
+ if (HeaderMask) {
+ VPBuilder LoopBuilder(FindLastSelect->getDefiningRecipe());
+ auto *Or = LoopBuilder.createLogicalAnd(HeaderMask,
----------------
lukel97 wrote:
Should this just set Cond directly? That way we wouldn't need the extra select in the middle block. And I think it would also mean we don't need to fix up the AnyOf for EVL tail folding
https://github.com/llvm/llvm-project/pull/191166
More information about the llvm-commits
mailing list