[clang] 3d454d2 - [LLVM][TypeSize] Remove default constructor. (#82810)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 28 03:48:58 PST 2024
Author: Paul Walker
Date: 2024-02-28T11:48:53Z
New Revision: 3d454d2895820cd1e6caa92f1e82ba468b5b5f09
URL: https://github.com/llvm/llvm-project/commit/3d454d2895820cd1e6caa92f1e82ba468b5b5f09
DIFF: https://github.com/llvm/llvm-project/commit/3d454d2895820cd1e6caa92f1e82ba468b5b5f09.diff
LOG: [LLVM][TypeSize] Remove default constructor. (#82810)
Added:
Modified:
clang/lib/CodeGen/CGCall.cpp
llvm/include/llvm/Support/TypeSize.h
llvm/unittests/Support/TypeSizeTest.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index d05cf1c6e1814e..0d86fcf544d0fd 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -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 &&
@@ -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 "
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index 1b793b0eccf3c7..68dbe1ea3062ab 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -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) {}
diff --git a/llvm/unittests/Support/TypeSizeTest.cpp b/llvm/unittests/Support/TypeSizeTest.cpp
index 34fe376989e7ba..b02b7e60095359 100644
--- a/llvm/unittests/Support/TypeSizeTest.cpp
+++ b/llvm/unittests/Support/TypeSizeTest.cpp
@@ -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));
More information about the cfe-commits
mailing list