[PATCH] D134373: [Analysis] Introduce getLastCallToStaticBonusApplied

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 10:56:12 PDT 2022


kazu added a comment.

In D134373#3806428 <https://reviews.llvm.org/D134373#3806428>, @mtrofin wrote:

> This is NFC, right? Is the use of it too complicated - not sure how I feel about code without use.

I've uploaded another patch (https://reviews.llvm.org/D134376) just to show the use site.  You'll find:

  bool P1ReducesCallerSize = -1000 < P1.Cost && P1.Cost < 0;

I'd like to be able to say:

  bool P1ReducesCallerSize = P1.Cost + P1.LastCallToStaticBonusApplied < 0;



================
Comment at: llvm/include/llvm/Analysis/InlineCost.h:99
+  /// The amount of LastCallToStaticBonus that has been applied.
+  int LastCallToStaticBonusApplied = 0;
+
----------------
mtrofin wrote:
> is this ever mutated?
Good point.  `const` is fine here.  I'll add `const` here.  I'll submit a follow-up patch to make `Cost` and `Threshold` const also.


================
Comment at: llvm/include/llvm/Analysis/InlineCost.h:155
+  /// Get the amount of LastCallToStaticBonus applied.
+  int getLastCallToStaticBonusApplied() const {
+    assert(isVariable() && "Invalid access of InlineCost");
----------------
davidxl wrote:
> should this include other bonuses added too? In that case, the interface name should change accordingly.
Maybe not.  At the moment, I am not planning to expose other bonuses applied.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134373



More information about the llvm-commits mailing list