[PATCH] D60740: [InlineCost] cleanup calculations of Cost and Threshold

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 21:45:08 PDT 2019


fedor.sergeev marked an inline comment as done.
fedor.sergeev added inline comments.


================
Comment at: lib/Analysis/InlineCost.cpp:295
 
+  void addCost(int64_t Inc, int64_t UpperBound = INT_MAX) {
+    Cost = std::min(UpperBound, Cost + Inc);
----------------
yrouban wrote:
> Cost is //int//, why do we use //int64_t//? May be //UpperBound// should be //int//?
This is inspired by the original visitSwitchInst usages, where calculation specifically used std::min to avoid int32 overflows.
I decided that it should be ok to use the same sequence elsewhere.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60740





More information about the llvm-commits mailing list