diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 55f36611a64f8..5e6fa2c8fc4ec 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -17208,8 +17208,7 @@ static bool actOnOMPReductionKindClause( Type = ComplexTy->getElementType(); if (Type->isRealFloatingType()) { llvm::APFloat InitValue = llvm::APFloat::getAllOnesValue( - Context.getFloatTypeSemantics(Type), - Context.getTypeSize(Type)); + Context.getFloatTypeSemantics(Type)); Init = FloatingLiteral::Create(Context, InitValue, /*isexact=*/true, Type, ELoc); } else if (Type->isScalarType()) { diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index f493a03b4b871..40e0e32c77a86 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -961,9 +961,7 @@ class APFloat : public APFloatBase { /// Returns a float which is bitcasted from an all one value int. /// /// \param Semantics - type float semantics - /// \param BitWidth - Select float type - static APFloat getAllOnesValue(const fltSemantics &Semantics, - unsigned BitWidth); + static APFloat getAllOnesValue(const fltSemantics &Semantics); /// Used to insert APFloat objects, or objects that contain APFloat objects, /// into FoldingSets. diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 0f2f76e86600b..30a5cae53889c 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -408,8 +408,7 @@ Constant *Constant::getAllOnesValue(Type *Ty) { APInt::getAllOnes(ITy->getBitWidth())); if (Ty->isFloatingPointTy()) { - APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics(), - Ty->getPrimitiveSizeInBits()); + APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics()); return ConstantFP::get(Ty->getContext(), FL); } diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 780d1d0c77b1d..fc2b1ae992b5e 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -4864,9 +4864,8 @@ APFloat::opStatus APFloat::convert(const fltSemantics &ToSemantics, llvm_unreachable("Unexpected semantics"); } -APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics, - unsigned BitWidth) { - return APFloat(Semantics, APInt::getAllOnes(BitWidth)); +APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics) { + return APFloat(Semantics, APInt::getAllOnes(Semantics.sizeInBits)); } void APFloat::print(raw_ostream &OS) const { diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index cd605d08d8ff0..2ed92c4f7f207 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -12204,8 +12204,8 @@ static SDValue lowerShuffleAsBitMask(const SDLoc &DL, MVT VT, SDValue V1, MVT LogicVT = VT; if (EltVT == MVT::f32 || EltVT == MVT::f64) { Zero = DAG.getConstantFP(0.0, DL, EltVT); - APFloat AllOnesValue = APFloat::getAllOnesValue( - SelectionDAG::EVTToAPFloatSemantics(EltVT), EltVT.getSizeInBits()); + APFloat AllOnesValue = + APFloat::getAllOnesValue(SelectionDAG::EVTToAPFloatSemantics(EltVT)); AllOnes = DAG.getConstantFP(AllOnesValue, DL, EltVT); LogicVT = MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, Mask.size());