[llvm] [VPlan] Support struct return types for widen intrinsics (NFC). (PR #165218)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 9 19:16:59 PST 2025


================
@@ -27,6 +28,30 @@ Type *llvm::toVectorizedStructTy(StructType *StructTy, ElementCount EC) {
       }));
 }
 
+Type *llvm::toVectorizedRetTy(Type *Ty, ElementCount EC, unsigned IID) {
+  if (EC.isScalar())
+    return Ty;
+
+  if (StructType *StructTy = dyn_cast<StructType>(Ty)) {
+    assert(isUnpackedStructLiteral(StructTy) &&
+           "expected unpacked struct literal");
+    assert(all_of(StructTy->elements(), VectorType::isValidElementType) &&
+           "expected all element types to be valid vector element types");
+    return StructType::get(
+        StructTy->getContext(),
+        map_to_vector(enumerate(StructTy->elements()), [&](auto It) -> Type * {
+          Type *ElTy = It.value();
+          if (IID != 0 &&
+              isVectorIntrinsicWithStructReturnScalarAtField(IID, It.index()))
+            return ElTy;
+          return VectorType::get(ElTy, EC);
+        }));
----------------
arcbbb wrote:

Updated. Thanks!

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


More information about the llvm-commits mailing list