Index: include/llvm/ADT/APSInt.h
===================================================================
--- include/llvm/ADT/APSInt.h	(revision 160311)
+++ include/llvm/ADT/APSInt.h	(working copy)
@@ -135,6 +135,20 @@
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return IsUnsigned ? uge(RHS) : sge(RHS);
   }
+  inline bool operator==(const APSInt& RHS) const {
+    assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+    return eq(RHS);
+  }
+  inline bool operator==(int RHS) const {
+    return isSameValue(*this, APSInt(APInt(64, RHS), true));
+  }
+  inline bool operator!=(const APSInt& RHS) const {
+    assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+    return ne(RHS);
+  }
+  inline bool operator!=(int RHS) const {
+    return !isSameValue(*this, APSInt(APInt(64, RHS), true));
+  }
 
   // The remaining operators just wrap the logic of APInt, but retain the
   // signedness information.
@@ -282,12 +296,18 @@
   void Profile(FoldingSetNodeID& ID) const;
 };
 
+inline bool operator==(int V1, const APSInt& V2) {
+  return V2 == V1;
+}
+inline bool operator!=(int V1, const APSInt& V2) {
+  return V2 != V1;
+}
+
 inline raw_ostream &operator<<(raw_ostream &OS, const APSInt &I) {
   I.print(OS, I.isSigned());
   return OS;
 }
 
-
 } // end namespace llvm
 
 #endif
