[llvm] [VectorCombine] Add support for zext/sext/trunc to shuffleToIdentity (PR #92696)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 06:08:57 PDT 2024


================
@@ -1773,7 +1772,9 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
         !cast<BinaryOperator>(Item[0].first)->isIntDivRem()) {
       Worklist.push_back(GenerateInstLaneVectorFromOperand(Item, 0));
       Worklist.push_back(GenerateInstLaneVectorFromOperand(Item, 1));
-    } else if (isa<UnaryOperator>(Item[0].first)) {
+    } else if (isa<UnaryOperator>(Item[0].first) ||
+               isa<TruncInst>(Item[0].first) || isa<ZExtInst>(Item[0].first) ||
+               isa<SExtInst>(Item[0].first)) {
----------------
alexey-bataev wrote:

```suggestion
    } else if (isa<UnaryOperator,TruncInst,ZExtInst,SExtInst>(Item[0].first))
```

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


More information about the llvm-commits mailing list