[llvm] 5169627 - [APFloat] scalbn - pass DoubleAPFloat arg as const-ref. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 07:32:35 PST 2021
Author: Simon Pilgrim
Date: 2021-01-28T15:18:24Z
New Revision: 5169627c14258595f70b4b47a2153e8d01e1c94a
URL: https://github.com/llvm/llvm-project/commit/5169627c14258595f70b4b47a2153e8d01e1c94a
DIFF: https://github.com/llvm/llvm-project/commit/5169627c14258595f70b4b47a2153e8d01e1c94a.diff
LOG: [APFloat] scalbn - pass DoubleAPFloat arg as const-ref. NFCI.
Avoid unnecessary copy and fix clang-tidy warning.
Added:
Modified:
llvm/include/llvm/ADT/APFloat.h
llvm/lib/Support/APFloat.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index 1f9ac22621a6..70a6cc44d3cc 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -688,7 +688,7 @@ class DoubleAPFloat final : public APFloatBase {
bool getExactInverse(APFloat *inv) const;
friend int ilogb(const DoubleAPFloat &Arg);
- friend DoubleAPFloat scalbn(DoubleAPFloat X, int Exp, roundingMode);
+ friend DoubleAPFloat scalbn(const DoubleAPFloat &X, int Exp, roundingMode);
friend DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode);
friend hash_code hash_value(const DoubleAPFloat &Arg);
};
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index b22b1540169d..1069d1fb4603 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -4761,7 +4761,8 @@ bool DoubleAPFloat::getExactInverse(APFloat *inv) const {
return Ret;
}
-DoubleAPFloat scalbn(DoubleAPFloat Arg, int Exp, APFloat::roundingMode RM) {
+DoubleAPFloat scalbn(const DoubleAPFloat &Arg, int Exp,
+ APFloat::roundingMode RM) {
assert(Arg.Semantics == &semPPCDoubleDouble && "Unexpected Semantics");
return DoubleAPFloat(semPPCDoubleDouble, scalbn(Arg.Floats[0], Exp, RM),
scalbn(Arg.Floats[1], Exp, RM));
More information about the llvm-commits
mailing list