Skip to content

Commit

Permalink
[LLVM][TypeSize] Remove default constructor. (#82810)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwalker-arm committed Feb 28, 2024
1 parent fe97a59 commit 3d454d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
15 changes: 6 additions & 9 deletions clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3221,12 +3221,10 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,

llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
llvm::TypeSize StructSize;
llvm::TypeSize PtrElementSize;
if (ArgI.isDirect() && !ArgI.getCanBeFlattened() && STy &&
STy->getNumElements() > 1) {
StructSize = CGM.getDataLayout().getTypeAllocSize(STy);
PtrElementSize =
llvm::TypeSize StructSize = CGM.getDataLayout().getTypeAllocSize(STy);
llvm::TypeSize PtrElementSize =
CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(Ty));
if (STy->containsHomogeneousScalableVectorTypes()) {
assert(StructSize == PtrElementSize &&
Expand Down Expand Up @@ -5310,12 +5308,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,

llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgInfo.getCoerceToType());
llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
llvm::TypeSize SrcTypeSize;
llvm::TypeSize DstTypeSize;
if (STy && ArgInfo.isDirect() && !ArgInfo.getCanBeFlattened()) {
SrcTypeSize = CGM.getDataLayout().getTypeAllocSize(SrcTy);
DstTypeSize = CGM.getDataLayout().getTypeAllocSize(STy);
llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
llvm::TypeSize SrcTypeSize =
CGM.getDataLayout().getTypeAllocSize(SrcTy);
llvm::TypeSize DstTypeSize = CGM.getDataLayout().getTypeAllocSize(STy);
if (STy->containsHomogeneousScalableVectorTypes()) {
assert(SrcTypeSize == DstTypeSize &&
"Only allow non-fractional movement of structure with "
Expand Down
2 changes: 0 additions & 2 deletions llvm/include/llvm/Support/TypeSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ class TypeSize : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
: FixedOrScalableQuantity(V) {}

public:
constexpr TypeSize() : FixedOrScalableQuantity(0, false) {}

constexpr TypeSize(ScalarTy Quantity, bool Scalable)
: FixedOrScalableQuantity(Quantity, Scalable) {}

Expand Down
1 change: 0 additions & 1 deletion llvm/unittests/Support/TypeSizeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ static_assert(INT64_C(2) * TSFixed32 == TypeSize::getFixed(64));
static_assert(UINT64_C(2) * TSFixed32 == TypeSize::getFixed(64));
static_assert(alignTo(TypeSize::getFixed(7), 8) == TypeSize::getFixed(8));

static_assert(TypeSize() == TypeSize::getFixed(0));
static_assert(TypeSize::getZero() == TypeSize::getFixed(0));
static_assert(TypeSize::getZero() != TypeSize::getScalable(0));
static_assert(TypeSize::getFixed(0) != TypeSize::getScalable(0));
Expand Down

0 comments on commit 3d454d2

Please sign in to comment.