[llvm] Avoid BlockFrequency overflow problems (PR #66280)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 13:31:53 PDT 2023


================
@@ -76,6 +78,12 @@ class BlockFrequency {
     return NewFreq;
   }
 
+  /// Multiplies frequency with `Factor` and stores the result into `Result`.
+  /// Returns `true` if an overflow occured. Overflows are common and should be
+  /// checked by all callers.
+  bool mul(uint64_t Factor,
----------------
kazutakahirata wrote:

Could we use `[[nodiscard]] bool` instead here?  We shouldn't have to use `__attribute__((warn_unused_result))` as `[[nodiscard]]` is available as part of C++17.

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


More information about the llvm-commits mailing list