Skip to content

Commit 899f19a

Browse files
committed
Move helpers
1 parent 91085c6 commit 899f19a

File tree

4 files changed

+19
-39
lines changed

4 files changed

+19
-39
lines changed

llvm/include/llvm/IR/StructWideningUtils.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

llvm/include/llvm/IR/VectorUtils.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLVM_IR_VECTORUTILS_H
1111

1212
#include "llvm/IR/DerivedTypes.h"
13-
#include "llvm/IR/StructWideningUtils.h"
1413

1514
namespace 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

llvm/lib/IR/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ add_llvm_component_library(LLVMCore
6464
PseudoProbe.cpp
6565
ReplaceConstant.cpp
6666
Statepoint.cpp
67-
StructWideningUtils.cpp
6867
StructuralHash.cpp
6968
Type.cpp
7069
TypedPointerType.cpp
@@ -74,6 +73,7 @@ add_llvm_component_library(LLVMCore
7473
Value.cpp
7574
ValueSymbolTable.cpp
7675
VectorBuilder.cpp
76+
VectorUtils.cpp
7777
Verifier.cpp
7878
VFABIDemangler.cpp
7979
RuntimeLibcalls.cpp

llvm/lib/IR/StructWideningUtils.cpp renamed to llvm/lib/IR/VectorUtils.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
//===- StructWideningUtils.cpp - Utils for vectorizing struct types------- ===//
1+
//===- VectorUtils.cpp - Vector type utility functions --------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "llvm/IR/StructWideningUtils.h"
10-
#include "llvm/ADT/SmallVectorExtras.h"
119
#include "llvm/IR/VectorUtils.h"
10+
#include "llvm/ADT/SmallVectorExtras.h"
1211

1312
using namespace llvm;
1413

0 commit comments

Comments
 (0)