Skip to content

Commit 566690b

Browse files
committed
[APFloat] Remove BitWidth argument from getAllOnesValue
There's no need to pass this in explicitly because it is trivially available from the semantics.
1 parent 45f9795 commit 566690b

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

clang/lib/Sema/SemaOpenMP.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -17208,8 +17208,7 @@ static bool actOnOMPReductionKindClause(
1720817208
Type = ComplexTy->getElementType();
1720917209
if (Type->isRealFloatingType()) {
1721017210
llvm::APFloat InitValue = llvm::APFloat::getAllOnesValue(
17211-
Context.getFloatTypeSemantics(Type),
17212-
Context.getTypeSize(Type));
17211+
Context.getFloatTypeSemantics(Type));
1721317212
Init = FloatingLiteral::Create(Context, InitValue, /*isexact=*/true,
1721417213
Type, ELoc);
1721517214
} else if (Type->isScalarType()) {

llvm/include/llvm/ADT/APFloat.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,7 @@ class APFloat : public APFloatBase {
961961
/// Returns a float which is bitcasted from an all one value int.
962962
///
963963
/// \param Semantics - type float semantics
964-
/// \param BitWidth - Select float type
965-
static APFloat getAllOnesValue(const fltSemantics &Semantics,
966-
unsigned BitWidth);
964+
static APFloat getAllOnesValue(const fltSemantics &Semantics);
967965

968966
/// Used to insert APFloat objects, or objects that contain APFloat objects,
969967
/// into FoldingSets.

llvm/lib/IR/Constants.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,7 @@ Constant *Constant::getAllOnesValue(Type *Ty) {
408408
APInt::getAllOnes(ITy->getBitWidth()));
409409

410410
if (Ty->isFloatingPointTy()) {
411-
APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics(),
412-
Ty->getPrimitiveSizeInBits());
411+
APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics());
413412
return ConstantFP::get(Ty->getContext(), FL);
414413
}
415414

llvm/lib/Support/APFloat.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -4864,9 +4864,8 @@ APFloat::opStatus APFloat::convert(const fltSemantics &ToSemantics,
48644864
llvm_unreachable("Unexpected semantics");
48654865
}
48664866

4867-
APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics,
4868-
unsigned BitWidth) {
4869-
return APFloat(Semantics, APInt::getAllOnes(BitWidth));
4867+
APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics) {
4868+
return APFloat(Semantics, APInt::getAllOnes(Semantics.sizeInBits));
48704869
}
48714870

48724871
void APFloat::print(raw_ostream &OS) const {

llvm/lib/Target/X86/X86ISelLowering.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12204,8 +12204,8 @@ static SDValue lowerShuffleAsBitMask(const SDLoc &DL, MVT VT, SDValue V1,
1220412204
MVT LogicVT = VT;
1220512205
if (EltVT == MVT::f32 || EltVT == MVT::f64) {
1220612206
Zero = DAG.getConstantFP(0.0, DL, EltVT);
12207-
APFloat AllOnesValue = APFloat::getAllOnesValue(
12208-
SelectionDAG::EVTToAPFloatSemantics(EltVT), EltVT.getSizeInBits());
12207+
APFloat AllOnesValue =
12208+
APFloat::getAllOnesValue(SelectionDAG::EVTToAPFloatSemantics(EltVT));
1220912209
AllOnes = DAG.getConstantFP(AllOnesValue, DL, EltVT);
1221012210
LogicVT =
1221112211
MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, Mask.size());

0 commit comments

Comments
 (0)