[llvm] [InstCombine] Propagate demanded elements through fma/fmuladd (PR #221495)

Hugo Pompougnac via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 09:48:46 PDT 2026


================
@@ -1998,6 +1999,27 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
           simplifyAndSetOp);
       if (V)
         return *V;
+
+      // Trivially vectorizable intrinsics operate elementwise: each result lane
+      // uses only the matching lane of the (vector) operands, so the demand
+      // passes through unchanged to every vector operand.
+      Intrinsic::ID IID = II->getIntrinsicID();
+      if (isTriviallyVectorizable(IID)) {
+        APInt PoisonEltsAcc(VWidth, 0);
+        for (Use &Arg : II->args()) {
+          unsigned OpNo = Arg.getOperandNo();
+          // Scalar operands do not carry per-lane demand.
+          if (isVectorIntrinsicWithScalarOpAtArg(IID, OpNo, /*TTI=*/nullptr))
----------------
qaco wrote:

Ok

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


More information about the llvm-commits mailing list