[llvm] [LV] Header masked condition of FindLastSelect when optimizeFindIVReductions when folding tail. (PR #191166)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 12:53:16 PDT 2026


================
@@ -5902,6 +5904,10 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
       }
     }
 
+    // Update the predicated select with FindLastSelect when folding tail.
+    if (HeaderMask)
+      PredSelect->setOperand(1, FindLastSelect);
----------------
fhahn wrote:

I think the latest version dropping 
>       FindLastSelect->getDefiningRecipe()->setOperand(0, Cond);

still misses some cases, notably the case when the expression gets sunk. I can submit a follow-up fix for that given that it's almost the weekend.

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


More information about the llvm-commits mailing list