[llvm] [LV] Support conditional scalar assignments of masked operations (PR #178862)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 03:14:43 PST 2026


================
@@ -1353,11 +1350,34 @@ bool VPlanTransforms::handleFindLastReductions(VPlan &Plan) {
                      PhiR->getRecurrenceKind()))
       continue;
 
-    // Find the condition for the select.
+    // Find the condition for the select/blend.
     auto *SelectR = cast<VPSingleDefRecipe>(&PhiR->getBackedgeRecipe());
     VPValue *Cond = nullptr, *Op1 = nullptr, *Op2 = nullptr;
+
+    // If we're matching a blend rather than a select, there should be one
+    // incoming value which is the data, then all other incoming values should
+    // be the phi.
+    auto MatchBlend = [&](VPRecipeBase *R) {
+      auto *Blend = dyn_cast<VPBlendRecipe>(R);
+      if (!Blend)
+        return false;
+      assert(!Blend->isNormalized());
----------------
sdesmalen-arm wrote:

Could this be written in such a way, that it doesn't have to rely on Blend not being normalized?

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


More information about the llvm-commits mailing list