1010#define LLVM_IR_VECTORUTILS_H
1111
1212#include " llvm/IR/DerivedTypes.h"
13- #include " llvm/IR/StructWideningUtils.h"
1413
1514namespace llvm {
1615
@@ -27,6 +26,18 @@ inline Type *ToVectorTy(Type *Scalar, unsigned VF) {
2726 return ToVectorTy (Scalar, ElementCount::getFixed (VF));
2827}
2928
29+ // / A helper for converting structs of scalar types to structs of vector types.
30+ // / Note: Only unpacked literal struct types are supported.
31+ Type *toVectorizedStructTy (StructType *StructTy, ElementCount EC);
32+
33+ // / A helper for converting structs of vector types to structs of scalar types.
34+ // / Note: Only unpacked literal struct types are supported.
35+ Type *toScalarizedStructTy (StructType *StructTy);
36+
37+ // / Returns true if `StructTy` is an unpacked literal struct where all elements
38+ // / are vectors of matching element count. This does not include empty structs.
39+ bool isVectorizedStructTy (StructType *StructTy);
40+
3041// / A helper for converting to vectorized types. For scalar types, this is
3142// / equivalent to calling `ToVectorTy`. For struct types, this returns a new
3243// / struct where each element type has been widened to a vector type. Note: Only
@@ -69,6 +80,10 @@ inline ElementCount getVectorizedTypeVF(Type *Ty) {
6980 return cast<VectorType>(getContainedTypes (Ty).front ())->getElementCount ();
7081}
7182
83+ inline bool isUnpackedStructLiteral (StructType *StructTy) {
84+ return StructTy->isLiteral () && !StructTy->isPacked ();
85+ }
86+
7287} // namespace llvm
7388
7489#endif
0 commit comments