[llvm] r250074 - Turn const/const& into value type for BlockFrequency in functions of this class. Also fix a naming issue. NFC.
Cong Hou via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 11:14:15 PDT 2015
Author: conghou
Date: Mon Oct 12 13:14:15 2015
New Revision: 250074
URL: http://llvm.org/viewvc/llvm-project?rev=250074&view=rev
Log:
Turn const/const& into value type for BlockFrequency in functions of this class. Also fix a naming issue. NFC.
Modified:
llvm/trunk/include/llvm/Support/BlockFrequency.h
llvm/trunk/lib/Support/BlockFrequency.cpp
Modified: llvm/trunk/include/llvm/Support/BlockFrequency.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BlockFrequency.h?rev=250074&r1=250073&r2=250074&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/BlockFrequency.h (original)
+++ llvm/trunk/include/llvm/Support/BlockFrequency.h Mon Oct 12 13:14:15 2015
@@ -38,7 +38,7 @@ public:
/// \brief Multiplies with a branch probability. The computation will never
/// overflow.
BlockFrequency &operator*=(BranchProbability Prob);
- const BlockFrequency operator*(BranchProbability Prob) const;
+ BlockFrequency operator*(BranchProbability Prob) const;
/// \brief Divide by a non-zero branch probability using saturating
/// arithmetic.
@@ -46,25 +46,25 @@ public:
BlockFrequency operator/(BranchProbability Prob) const;
/// \brief Adds another block frequency using saturating arithmetic.
- BlockFrequency &operator+=(const BlockFrequency &Freq);
- const BlockFrequency operator+(const BlockFrequency &Freq) const;
+ BlockFrequency &operator+=(BlockFrequency Freq);
+ BlockFrequency operator+(BlockFrequency Freq) const;
/// \brief Shift block frequency to the right by count digits saturating to 1.
BlockFrequency &operator>>=(const unsigned count);
- bool operator<(const BlockFrequency &RHS) const {
+ bool operator<(BlockFrequency RHS) const {
return Frequency < RHS.Frequency;
}
- bool operator<=(const BlockFrequency &RHS) const {
+ bool operator<=(BlockFrequency RHS) const {
return Frequency <= RHS.Frequency;
}
- bool operator>(const BlockFrequency &RHS) const {
+ bool operator>(BlockFrequency RHS) const {
return Frequency > RHS.Frequency;
}
- bool operator>=(const BlockFrequency &RHS) const {
+ bool operator>=(BlockFrequency RHS) const {
return Frequency >= RHS.Frequency;
}
};
Modified: llvm/trunk/lib/Support/BlockFrequency.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/BlockFrequency.cpp?rev=250074&r1=250073&r2=250074&view=diff
==============================================================================
--- llvm/trunk/lib/Support/BlockFrequency.cpp (original)
+++ llvm/trunk/lib/Support/BlockFrequency.cpp Mon Oct 12 13:14:15 2015
@@ -22,8 +22,7 @@ BlockFrequency &BlockFrequency::operator
return *this;
}
-const BlockFrequency
-BlockFrequency::operator*(BranchProbability Prob) const {
+BlockFrequency BlockFrequency::operator*(BranchProbability Prob) const {
BlockFrequency Freq(Frequency);
Freq *= Prob;
return Freq;
@@ -40,7 +39,7 @@ BlockFrequency BlockFrequency::operator/
return Freq;
}
-BlockFrequency &BlockFrequency::operator+=(const BlockFrequency &Freq) {
+BlockFrequency &BlockFrequency::operator+=(BlockFrequency Freq) {
uint64_t Before = Freq.Frequency;
Frequency += Freq.Frequency;
@@ -51,11 +50,10 @@ BlockFrequency &BlockFrequency::operator
return *this;
}
-const BlockFrequency
-BlockFrequency::operator+(const BlockFrequency &Prob) const {
- BlockFrequency Freq(Frequency);
- Freq += Prob;
- return Freq;
+BlockFrequency BlockFrequency::operator+(BlockFrequency Freq) const {
+ BlockFrequency NewFreq(Frequency);
+ NewFreq += Freq;
+ return NewFreq;
}
BlockFrequency &BlockFrequency::operator>>=(const unsigned count) {
More information about the llvm-commits
mailing list