[llvm] [VectorCombine] Add intrinsics handling to shuffleToIdentity (PR #91000)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 09:12:44 PDT 2024


================
@@ -1770,6 +1772,20 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
       Worklist.push_back(GenerateInstLaneVectorFromOperand(Item, 1));
     } else if (isa<UnaryOperator>(Item[0].first)) {
       Worklist.push_back(GenerateInstLaneVectorFromOperand(Item, 0));
+    } else if (auto *II = dyn_cast<IntrinsicInst>(Item[0].first);
+               II && isTriviallyVectorizable(II->getIntrinsicID())) {
+      for (unsigned O = 0; O < II->getNumOperands() - 1; O++) {
----------------
davemgreen wrote:

Good point :) It was just short-hard for the operation number and I perhaps made it too short. I'll switch it over to use Op.

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


More information about the llvm-commits mailing list