[llvm] [VectorCombine] Add constant splat handling for shuffleToIdentity (PR #92797)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 10:59:09 PDT 2024


================
@@ -1739,6 +1739,15 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
       IdentityLeafs.insert(Item[0].first);
       continue;
     }
+    // Look for constants, for the moment only supporting constant splats.
+    if (isa<Constant>(Item[0].first) &&
+        cast<Constant>(Item[0].first)->getSplatValue() &&
----------------
alexey-bataev wrote:

```suggestion
    if (auto *C = dyn_cast<Constant>(Item[0].first); C &&
        C->getSplatValue() &&
```

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


More information about the llvm-commits mailing list