[llvm] [VPlan] Consolidate logic for narrow to single scalars (PR #151506)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 07:44:17 PDT 2025


================
@@ -40,6 +40,9 @@ const SCEV *getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE);
 /// Returns true if \p VPV is a single scalar, either because it produces the
 /// same value for all lanes or only has its first lane used.
 inline bool isSingleScalar(const VPValue *VPV) {
+  if (onlyFirstLaneUsed(VPV))
+    return true;
+
----------------
fhahn wrote:

This isn't correct in general unfortunately, as VPReplicateRecipe contains recipes which don't really defined a VPValue and are not single-scalars (e.g. replicating store). It the check will pass here, because the VPValue doesn't have any users

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


More information about the llvm-commits mailing list