[llvm] [RISCV] Fix matching bug in VLA shuffle lowering (PR #134750)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 03:49:05 PDT 2025


================
@@ -5424,13 +5424,13 @@ static bool isLowSourceShuffle(ArrayRef<int> Mask, int Span) {
 /// span, and then repeats that same result across all remaining spans.  Note
 /// that this doesn't check if all the inputs come from a single span!
 static bool isSpanSplatShuffle(ArrayRef<int> Mask, int Span) {
-  SmallVector<int> LowSpan(Span, -1);
+  // Require a prefix from the original mask until the consumer code
+  // is adjusted to rewrite the mask instead of just taking a prefix.
+  SmallVector<int> LowSpan(Mask.take_front(Span));
----------------
lukel97 wrote:

Same nit here, only worthwhile if you don't think we'll need the SmallVector again for the mask-rewriting patch
```suggestion
  ArrayRef<int> LowSpan = Mask.take_front(Span);
```

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


More information about the llvm-commits mailing list