[APFloat] Remove BitWidth argument from getAllOnesValue

There's no need to pass this in explicitly because it is
trivially available from the semantics.
This commit is contained in:
Jay Foad
2021-10-04 10:20:18 +01:00
parent 45f9795085
commit 566690b067
5 changed files with 7 additions and 12 deletions

View File

@@ -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()) {

View File

@@ -961,9 +961,7 @@ public:
/// 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.

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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());