From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- clang/lib/CodeGen/PatternInit.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'clang/lib/CodeGen/PatternInit.cpp') diff --git a/clang/lib/CodeGen/PatternInit.cpp b/clang/lib/CodeGen/PatternInit.cpp index 3410c7f21533..26ac8b63a9ba 100644 --- a/clang/lib/CodeGen/PatternInit.cpp +++ b/clang/lib/CodeGen/PatternInit.cpp @@ -8,6 +8,7 @@ #include "PatternInit.h" #include "CodeGenModule.h" +#include "clang/Basic/TargetInfo.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Type.h" @@ -33,17 +34,15 @@ llvm::Constant *clang::CodeGen::initializationPatternFor(CodeGenModule &CGM, constexpr bool NegativeNaN = true; constexpr uint64_t NaNPayload = 0xFFFFFFFFFFFFFFFFull; if (Ty->isIntOrIntVectorTy()) { - unsigned BitWidth = cast( - Ty->isVectorTy() ? Ty->getVectorElementType() : Ty) - ->getBitWidth(); + unsigned BitWidth = + cast(Ty->getScalarType())->getBitWidth(); if (BitWidth <= 64) return llvm::ConstantInt::get(Ty, IntValue); return llvm::ConstantInt::get( Ty, llvm::APInt::getSplat(BitWidth, llvm::APInt(64, IntValue))); } if (Ty->isPtrOrPtrVectorTy()) { - auto *PtrTy = cast( - Ty->isVectorTy() ? Ty->getVectorElementType() : Ty); + auto *PtrTy = cast(Ty->getScalarType()); unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth( PtrTy->getAddressSpace()); if (PtrWidth > 64) @@ -54,8 +53,7 @@ llvm::Constant *clang::CodeGen::initializationPatternFor(CodeGenModule &CGM, } if (Ty->isFPOrFPVectorTy()) { unsigned BitWidth = llvm::APFloat::semanticsSizeInBits( - (Ty->isVectorTy() ? Ty->getVectorElementType() : Ty) - ->getFltSemantics()); + Ty->getScalarType()->getFltSemantics()); llvm::APInt Payload(64, NaNPayload); if (BitWidth >= 64) Payload = llvm::APInt::getSplat(BitWidth, Payload); -- cgit v1.2.3