[llvm] [VPlan] Fold FirstOrderRecurrenceSplice(X, X) to X when X is uniform (PR #171772)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 11 03:02:20 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)) {
----------------
paulwalker-arm wrote:
I'm not familiar with VPlan corner cases so I apologise if this is nonsense but vputils::isSingleScalar says "because it produces the same value for all lanes or only has its first lane used".
For the second part of this classification when using vector operands (say <2 x i32>) we kind of have a bogus splice because the result of splice(A, A, -1) could be represented as `<poison, A[0]>` because `isSingleScalar` says we should only be using the first lane? Returning `splat(A[0])` here seems fine, but returning `A` seems wrong because then we're now saying Result[0] is valid but Result[1] is not, which is the opposite of what the splice returned (i.e. Result[1] is valid, but Result[0] is not).
https://github.com/llvm/llvm-project/pull/171772
More information about the llvm-commits
mailing list