Fix -Wdeprecated warnings due to the use of copy ops on SCEVPredicate derived class...
[oota-llvm.git] / lib / Support / BlockFrequency.cpp
index e0430c199eb86e2b9fec33224d8a1521805598b3..e7f3e1764c52d3a6131f022b081227b2f0887f06 100644 (file)
@@ -56,6 +56,21 @@ BlockFrequency BlockFrequency::operator+(BlockFrequency Freq) const {
   return NewFreq;
 }
 
+BlockFrequency &BlockFrequency::operator-=(BlockFrequency Freq) {
+  // If underflow, set frequency to 0.
+  if (Frequency <= Freq.Frequency)
+    Frequency = 0;
+  else
+    Frequency -= Freq.Frequency;
+  return *this;
+}
+
+BlockFrequency BlockFrequency::operator-(BlockFrequency Freq) const {
+  BlockFrequency NewFreq(Frequency);
+  NewFreq -= Freq;
+  return NewFreq;
+}
+
 BlockFrequency &BlockFrequency::operator>>=(const unsigned count) {
   // Frequency can never be 0 by design.
   assert(Frequency != 0);