[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
index aa100a796f2d60e23b59b51e6215a54229f124f9..384edddf85a956a70fa7413cf4e5d1eed86d4dbc 100644 (file)
@@ -226,7 +226,7 @@ struct InstrProfValueSiteRecord {
       while (I != IE && I->Value < J->Value)
         ++I;
       if (I != IE && I->Value == J->Value) {
-        I->Count += J->Count;
+        I->Count = SaturatingAdd(I->Count, J->Count);
         ++I;
         continue;
       }