[llvm] [VectorCombine] foldShuffleOfShuffles - fold shuffle(shuffle(x,y),poison) length changing masks (PR #144690)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 21 06:07:12 PDT 2025


================
@@ -2275,6 +2275,17 @@ bool VectorCombine::foldShuffleOfShuffles(Instruction &I) {
   if (!Match0 && !Match1)
     return false;
 
+  // If the outer shuffle is a permute, then create a fake inner all-poison
+  // shuffle. This is easier than accounting for length-changing shuffles below.
+  SmallVector<int, 16> PoisonMask1;
+  if (Match0 && !Match1 && isa<PoisonValue>(OuterV1)) {
----------------
dtcxzyw wrote:

```suggestion
  if (!Match1 && isa<PoisonValue>(OuterV1)) {
```
`!(!Match0 && !Match1) && !Match1` implies `Match0`.


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


More information about the llvm-commits mailing list