[PATCH] D60751: [NFC][InlineCost] cleanup - comments, overflow handling.

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 18:14:35 PDT 2019


apilipenko accepted this revision.
apilipenko added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Analysis/InlineCost.cpp:247
+  /// Handle a capped 'int' increment for Cost.
+  void addCost(int64_t Inc, int64_t UpperBound = INT_MAX) {
+    Cost = std::min(UpperBound, Cost + Inc);
----------------
yrouban wrote:
> I believe that both //Inc// and //UpperBound// must be of the same type as //Cost// (i.e. //int//) but the parameters of std::max() should be extended.
Agree. An explicit cast to a wider type is more clear.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60751/new/

https://reviews.llvm.org/D60751





More information about the llvm-commits mailing list