[llvm] [VPlan] Fold FirstOrderRecurrenceSplice(X, X) to X when X is uniform (PR #171772)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 23:49:01 PST 2025


================
@@ -1449,6 +1449,14 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
     return;
   }
 
+  // Replace splice(A, A, -1) with A if A is uniform.
+  if (match(Def, m_VPInstruction<VPInstruction::FirstOrderRecurrenceSplice>(
+                     m_VPValue(A), m_Deferred(A))) &&
+      vputils::isSingleScalar(A)) {
+    Def->replaceAllUsesWith(A);
+    return;
+  }
----------------
artagnon wrote:

```suggestion
      vputils::isSingleScalar(A))
    return Def->replaceAllUsesWith(A);
```

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


More information about the llvm-commits mailing list