================
@@ -2034,6 +2071,18 @@ static Value *convertValue(const DataLayout &DL, 
IRBuilderTy &IRB, Value *V,
     }
   }
 
+  if (isa<ScalableVectorType>(NewTy) && isa<FixedVectorType>(OldTy)) {
+    auto *Ty = VectorType::getWithSizeAndScalar(cast<VectorType>(NewTy), 
OldTy);
+    V = IRB.CreateInsertVector(Ty, PoisonValue::get(Ty), V, IRB.getInt64(0));
+    return IRB.CreateBitCast(V, NewTy);
+  }
+
+  if (isa<FixedVectorType>(NewTy) && isa<ScalableVectorType>(OldTy)) {
+    auto *Ty = VectorType::getWithSizeAndScalar(cast<VectorType>(OldTy), 
NewTy);
+    V = IRB.CreateBitCast(V, Ty);
+    return IRB.CreateExtractVector(NewTy, V, IRB.getInt64(0));
+  }
----------------
paulwalker-arm wrote:

I've extended the coverage to input pointer casts but creating a wrapper 
function so that existing uses of CreateBitCast are replaced with a variant 
that supports bit casting between fixed and scalable vector types.

https://github.com/llvm/llvm-project/pull/130973
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to