[llvm] [Sample Profile] Expand functionality of llvm-profdata function filter (PR #101615)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 10 20:08:13 PDT 2024


================
@@ -757,11 +767,10 @@ class FunctionSamples {
                       : sampleprof_error::success;
   }
 
-  void removeTotalSamples(uint64_t Num) {
-    if (TotalSamples < Num)
-      TotalSamples = 0;
-    else
-      TotalSamples -= Num;
+  uint64_t removeTotalSamples(uint64_t Num) {
+    Num = std::min(Num, TotalSamples);
+    TotalSamples -= Num;
+    return Num;
----------------
WenleiHe wrote:

This change seems unnecessary. Why is the new version better? 

https://github.com/llvm/llvm-project/pull/101615


More information about the llvm-commits mailing list