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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 03:17:53 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)) {
----------------
lukel97 wrote:

Good point, should probably explicitly match on `m_Broadcast`. I think that should still catch these cases after materializeBroadcasts.

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


More information about the llvm-commits mailing list