Turn const/const& into value type for BlockFrequency in functions of this class....
authorCong Hou <congh@google.com>
Mon, 12 Oct 2015 18:14:15 +0000 (18:14 +0000)
committerCong Hou <congh@google.com>
Mon, 12 Oct 2015 18:14:15 +0000 (18:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250074 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/BlockFrequency.h
lib/Support/BlockFrequency.cpp

index 25f1485..2dccfa2 100644 (file)
@@ -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;
   }
 };
index dbd790c..e0430c1 100644 (file)
@@ -22,8 +22,7 @@ BlockFrequency &BlockFrequency::operator*=(BranchProbability Prob) {
   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/(BranchProbability Prob) const {
   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+=(const BlockFrequency &Freq) {
   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) {