diff --git a/include/llvm/Support/TypeSize.h b/include/llvm/Support/TypeSize.h index f66c043b29f..35db42336a7 100644 --- a/include/llvm/Support/TypeSize.h +++ b/include/llvm/Support/TypeSize.h @@ -149,6 +149,9 @@ public: // Returns true if the type size is non-zero. bool isNonZero() const { return MinSize != 0; } + // Returns true if the type size is zero. + bool isZero() const { return MinSize == 0; } + // Casts to a uint64_t if this is a fixed-width size. // // This interface is deprecated and will be removed in a future version diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 87c22b3609a..0adabf27917 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -363,7 +363,7 @@ Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, Constant *ElemC; do { ElemC = C->getAggregateElement(Elem++); - } while (ElemC && DL.getTypeSizeInBits(ElemC->getType()) == 0); + } while (ElemC && DL.getTypeSizeInBits(ElemC->getType()).isZero()); C = ElemC; } else { C = C->getAggregateElement(0u); diff --git a/lib/Target/AArch64/AArch64CallLowering.cpp b/lib/Target/AArch64/AArch64CallLowering.cpp index 080c1f1364b..aace22aa59c 100644 --- a/lib/Target/AArch64/AArch64CallLowering.cpp +++ b/lib/Target/AArch64/AArch64CallLowering.cpp @@ -420,7 +420,7 @@ bool AArch64CallLowering::lowerFormalArguments( SmallVector SplitArgs; unsigned i = 0; for (auto &Arg : F.args()) { - if (DL.getTypeStoreSize(Arg.getType()) == 0) + if (DL.getTypeStoreSize(Arg.getType()).isZero()) continue; ArgInfo OrigArg{VRegs[i], Arg.getType()};