[all-commits] [llvm/llvm-project] 0a0ccc: [ModuleInliner] Factor out common code in InlineOr...

kazutakahirata via All-commits all-commits at lists.llvm.org
Wed Sep 21 08:50:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a0ccc85bb4bd190302ac194d401f27960e05ebe
      https://github.com/llvm/llvm-project/commit/0a0ccc85bb4bd190302ac194d401f27960e05ebe
  Author: Kazu Hirata <kazu at google.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    M llvm/lib/Analysis/InlineOrder.cpp

  Log Message:
  -----------
  [ModuleInliner] Factor out common code in InlineOrder.cpp (NFC)

This patch factors out common code in InlineOrder.cpp.

Without this patch, the model is to ask classes like SizePriority and
CostPriority to compare a pair of call sites:

  bool hasLowerPriority(const CallBase *L, const CallBase *R) const override {

while these priority classes have their own caches of priorities:

  DenseMap<const CallBase *, PriorityT> Priorities;

This model results in a lot of duplicate code like hasLowerPriority
and updateAndCheckDecreased.

This patch changes the model so that priority classes just have two
methods to compute a priority for a given call site and to compare two
previously computed priorities (as opposed to call sites).

Facilities like hasLowerPriority and updateAndCheckDecreased move to
PriorityInlineOrder along with the map from call sites to their
priorities.  PriorityInlineOrder becomes a template class so that it
can accommodate different priority classes.

Differential Revision: https://reviews.llvm.org/D134149




More information about the All-commits mailing list