[llvm] [VectorCombine] Allow shuffling between vectors the same type but different element sizes (PR #121216)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 09:02:26 PST 2025


================
@@ -3059,6 +3087,13 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
   if (OldCost < NewCost)
     return false;
 
+  if (NeedExpOrNarrow) {
+    if (!NeedDstSrcSwap)
+      SrcVec = Builder.CreateShuffleVector(SrcVec, ExtToVecMask);
+    else
+      DstVec = Builder.CreateShuffleVector(DstVec, ExtToVecMask);
----------------
ParkHanbum wrote:

Yes, I wrote the code like this because the position of SrcVec changes depending on when it was swapped and when it was not.

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


More information about the llvm-commits mailing list