[llvm] r207541 - Support: Simplify BranchProbability operators

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Apr 29 09:12:16 PDT 2014


Author: dexonsmith
Date: Tue Apr 29 11:12:16 2014
New Revision: 207541

URL: http://llvm.org/viewvc/llvm-project?rev=207541&view=rev
Log:
Support: Simplify BranchProbability operators

Modified:
    llvm/trunk/include/llvm/Support/BranchProbability.h

Modified: llvm/trunk/include/llvm/Support/BranchProbability.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BranchProbability.h?rev=207541&r1=207540&r2=207541&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/BranchProbability.h (original)
+++ llvm/trunk/include/llvm/Support/BranchProbability.h Tue Apr 29 11:12:16 2014
@@ -59,15 +59,9 @@ public:
   bool operator<(BranchProbability RHS) const {
     return (uint64_t)N * RHS.D < (uint64_t)D * RHS.N;
   }
-  bool operator>(BranchProbability RHS) const {
-    return RHS < *this;
-  }
-  bool operator<=(BranchProbability RHS) const {
-    return (uint64_t)N * RHS.D <= (uint64_t)D * RHS.N;
-  }
-  bool operator>=(BranchProbability RHS) const {
-    return RHS <= *this;
-  }
+  bool operator>(BranchProbability RHS) const { return RHS < *this; }
+  bool operator<=(BranchProbability RHS) const { return !(RHS < *this); }
+  bool operator>=(BranchProbability RHS) const { return !(*this < RHS); }
 };
 
 raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob);





More information about the llvm-commits mailing list