[llvm] [VPlan] Support different loop-invariant ops in narrowIG. (PR #203785)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 28 12:45:16 PDT 2026


================
@@ -5760,15 +5760,15 @@ VPlanTransforms::expandSCEVs(VPlan &Plan, ScalarEvolution &SE) {
 static bool canNarrowLoad(VPSingleDefRecipe *WideMember0, unsigned OpIdx,
                           VPValue *OpV, unsigned Idx, bool IsScalable) {
   VPValue *Member0Op = WideMember0->getOperand(OpIdx);
-  VPRecipeBase *Member0OpR = Member0Op->getDefiningRecipe();
-  if (!Member0OpR) {
-    // Member0's operand is a uniform live-in, broadcast across all fields.
+  if (Member0Op->isDefinedOutsideLoopRegions()) {
+    // Operand matches Member0, broadcast across all fields.
     if (Member0Op == OpV)
       return true;
----------------
fhahn wrote:

Yep, we broadcast (implicitly at this point) if the operand is the same recipe / live-in across all lanes. Updated, thanks

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


More information about the llvm-commits mailing list