[llvm] [VFABI] Add support for vector functions that return struct types (PR #119000)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 01:59:42 PST 2024
================
@@ -0,0 +1,57 @@
+//===- StructWideningUtils.cpp - Utils for widening/narrowing struct types ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/StructWideningUtils.h"
+#include "llvm/ADT/SmallVectorExtras.h"
+#include "llvm/IR/VectorUtils.h"
+
+using namespace llvm;
+
+static bool isUnpackedStructLiteral(StructType *StructTy) {
+ return StructTy->isLiteral() && !StructTy->isPacked();
+}
+
+/// A helper for converting structs of scalar types to structs of vector types.
+/// Note: Only unpacked literal struct types are supported.
+Type *llvm::ToWideStructTy(StructType *StructTy, ElementCount EC) {
----------------
david-arm wrote:
What if this is a struct of structs, or the struct contains an array? It's fine to treat this as user error - the caller probably shouldn't be attempting to widen such a struct in the same way that you should only call `ToVectorTy` on a scalar type. But it might be worth either adding a comment or an assert?
https://github.com/llvm/llvm-project/pull/119000
More information about the llvm-commits
mailing list