[llvm] [VFABI] Add support for vector functions that return struct types (PR #119000)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 08:26:34 PST 2024


================
@@ -0,0 +1,73 @@
+//===----------- VectorUtils.cpp - Vector type utility functions ----------===//
+//
+// 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/CallWideningUtils.h"
+#include "llvm/ADT/SmallVectorExtras.h"
+#include "llvm/IR/VectorUtils.h"
+
+using namespace llvm;
+
+/// A helper for converting to wider (vector) types. For scalar types, this is
+/// equivalent to calling `ToVectorTy`. For struct types, this returns a new
+/// struct where each element type has been widened to a vector type. Note: Only
+/// unpacked literal struct types are supported.
+Type *llvm::ToWideTy(Type *Ty, ElementCount EC) {
----------------
MacDue wrote:

I think I'm a little unclear on how other strategies could work in practice here. If you widened `struct { i32, i32 }` to `<4 x i32>` where that's meant to represent the interleaved access of two structs, you hit the problem that now there's no defined mapping from `<4 x i32>` back to a narrow type. It could have came from a struct, or a scalar i32. 



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


More information about the llvm-commits mailing list