[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 05:20:01 PST 2025


================
@@ -4620,7 +4620,8 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
       Type *ScalarTy = TypeInfo.inferScalarType(ToCheck);
       if (!Visited.insert({ScalarTy}).second)
         continue;
-      if (WillWiden(ScalarTy))
+      Type *WideTy = toVectorizedTy(ScalarTy, VF);
+      if (any_of(getContainedTypes(WideTy), WillWiden))
----------------
MacDue wrote:

I think `any_of` makes sense in the context of how this is used. This is part of `willGenerateVectors` (which is called after a plan is constructed (for a few `ForceVectorization` checks). To check if a plan will generate vectors, I think just seeing if any member is a vector is enough. 

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


More information about the llvm-commits mailing list