[llvm] [LV][REVEC] Initial support for re-vectorisation (PR #208213)

Gaëtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 01:52:33 PDT 2026


================
@@ -14,19 +14,40 @@
 
 namespace llvm {
 
-/// A helper function for converting Scalar types to vector types. If
+/// A helper function for converting scalar or vector types to vector types. If
 /// the incoming type is void, we return void. If the EC represents a
-/// scalar, we return the scalar type.
+/// scalar, we return the input type. For vector inputs, the existing vector
+/// element count is multiplied by EC.
 inline Type *toVectorTy(Type *Scalar, ElementCount EC) {
----------------
gbossu wrote:

Sorry I had seen you comment and was thinking about it, but I forgot to write an answer...

My interpretation of `toVectorizedTy()` is that it's for "container" types that cannot be vectorised directly, but whose members can. I don't think using it gives a clearer hint that "the input type might already be a vector".

That said, I also agree that the `toVectorTy()` can be confusing now, as one wouldn't expect an already-vector type as input. I could introduce `toVectorOrWiderVectorTy()` if you or others feel it's a helpful change 🙂 

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


More information about the llvm-commits mailing list