Skip to content
  1. Jun 18, 2021
  2. Jun 07, 2021
  3. Jun 06, 2021
  4. May 22, 2021
  5. May 08, 2021
  6. May 04, 2021
  7. Apr 27, 2021
  8. Mar 15, 2021
  9. Jan 26, 2021
    • modimo's avatar
      [InlineAdvisor] Allow replay of inline decisions for the CGSCC inliner from optimization remarks · ce7f9cdb
      modimo authored
      This change leverages the work done in D83743 to replay in the SampleProfile inliner to also be used in the CGSCC inliner. NOTE: currently restricted to non-ML advisors only.
      
      The added switch `-cgscc-inline-replay=<remarks file>` will replay the inlining decisions in that file where the remarks file is generated via `-Rpass=inline`. The aim here is to make it easier to analyze changes that would modify inlining heuristics to be separated from this behavior. Doing so allows easier examination of assembly and runtime behavior compared to the baseline rather than trying to dig through the large churn caused by inlining.
      
      In LTO compilation, since inlining is done twice you can separately specify replay by passing the flag to the FE (`-cgscc-inline-replay=`) and to the linker (`-Wl,cgscc-inline-replay=`) with the remarks generated from their respective places.
      
      Testing on mysqld by comparing the inline decisions between base (generates remarks.txt) and diff (replay using identical input/tools with remarks.txt) and examining the inlining sites with `diff` shows 14,000 mismatches out of 247,341 for a ~94% replay accuracy. I believe this gap can be narrowed further though for the general case we may never achieve full accuracy. For my personal use, this is close enough to be representative: I set the baseline as the one generated by the replay on identical input/toolset and compare that to my modified input/toolset using the same replay.
      
      Testing:
      ninja check-llvm
      newly added test correctly replays CGSCC inlining decisions
      
      Reviewed By: mtrofin, wenlei
      
      Differential Revision: https://reviews.llvm.org/D94334
      ce7f9cdb
  10. Jan 22, 2021
  11. Jan 20, 2021
  12. Jan 16, 2021
  13. Dec 17, 2020
  14. Dec 12, 2020
  15. Dec 03, 2020
  16. Nov 30, 2020
    • Mircea Trofin's avatar
      [llvm][inliner] Reuse the inliner pass to implement 'always inliner' · 5fe10263
      Mircea Trofin authored
      Enable performing mandatory inlinings upfront, by reusing the same logic
      as the full inliner, instead of the AlwaysInliner. This has the
      following benefits:
      - reduce code duplication - one inliner codebase
      - open the opportunity to help the full inliner by performing additional
      function passes after the mandatory inlinings, but before th full
      inliner. Performing the mandatory inlinings first simplifies the problem
      the full inliner needs to solve: less call sites, more contextualization, and,
      depending on the additional function optimization passes run between the
      2 inliners, higher accuracy of cost models / decision policies.
      
      Note that this patch does not yet enable much in terms of post-always
      inline function optimization.
      
      Differential Revision: https://reviews.llvm.org/D91567
      5fe10263
  17. Nov 13, 2020
  18. Nov 11, 2020
    • Arthur Eubanks's avatar
      [CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass · d9cbceb0
      Arthur Eubanks authored
      Previously the inliner did a bit of a hack by adding ref edges for all
      new edges introduced by performing an inline before calling
      updateCGAndAnalysisManagerForPass(). This was because
      updateCGAndAnalysisManagerForPass() didn't handle new non-trivial call
      edges.
      
      This adds handling of non-trivial call edges to
      updateCGAndAnalysisManagerForPass().  The inliner called
      updateCGAndAnalysisManagerForFunctionPass() since it was handling adding
      newly introduced edges (so updateCGAndAnalysisManagerForPass() would
      only have to handle promotion), but now it needs to call
      updateCGAndAnalysisManagerForCGSCCPass() since
      updateCGAndAnalysisManagerForPass() is now handling the new call edges
      and function passes cannot add new edges.
      
      We follow the previous path of adding trivial ref edges then letting promotion
      handle changing the ref edges to call edges and the CGSCC updates. So
      this still does not allow adding call edges that result in an addition
      of a non-trivial ref edge.
      
      This is in preparation for better detecting devirtualization. Previously
      since the inliner itself would add ref edges,
      updateCGAndAnalysisManagerForPass() would think that promotion and thus
      devirtualization had happened after any sort of inlining.
      
      Reviewed By: asbirlea
      
      Differential Revision: https://reviews.llvm.org/D91046
      d9cbceb0
  19. Oct 24, 2020
  20. Oct 23, 2020
    • Arthur Eubanks's avatar
      [Inliner] Run always-inliner in inliner-wrapper · 0291e2c9
      Arthur Eubanks authored
      An alwaysinline function may not get inlined in inliner-wrapper due to
      the inlining order.
      
      Previously for the following, the inliner would first inline @a() into @b(),
      
      ```
      define void @a() {
      entry:
        call void @b()
        ret void
      }
      
      define void @b() alwaysinline {
      entry:
        br label %for.cond
      
      for.cond:
        call void @a()
        br label %for.cond
      }
      ```
      
      making @b() recursive and unable to be inlined into @a(), ending at
      
      ```
      define void @a() {
      entry:
        call void @b()
        ret void
      }
      
      define void @b() alwaysinline {
      entry:
        br label %for.cond
      
      for.cond:
        call void @b()
        br label %for.cond
      }
      ```
      
      Running always-inliner first makes sure that we respect alwaysinline in more cases.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=46945.
      
      Reviewed By: davidxl, rnk
      
      Differential Revision: https://reviews.llvm.org/D86988
      0291e2c9
  21. Jul 07, 2020
  22. Jul 02, 2020
  23. Jun 01, 2020
    • Mircea Trofin's avatar
      [llvm][NFC] Cache FAM in InlineAdvisor · 999ea25a
      Mircea Trofin authored
      Summary:
      This simplifies the interface by storing the function analysis manager
      with the InlineAdvisor, and, thus, not requiring it be passed each time
      we inquire for an advice.
      
      Reviewers: davidxl, asbirlea
      
      Subscribers: eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D80405
      999ea25a
  24. May 18, 2020
  25. May 16, 2020
  26. May 15, 2020
  27. May 13, 2020
  28. May 11, 2020
  29. May 05, 2020
    • Kazu Hirata's avatar
      [Inlining] Teach shouldBeDeferred to take the total cost into account · e8984fe6
      Kazu Hirata authored
      Summary:
      This patch teaches shouldBeDeferred to take into account the total
      cost of inlining.
      
      Suppose we have a call hierarchy {A1,A2,A3,...}->B->C.  (Each of A1,
      A2, A3, ... calls B, which in turn calls C.)
      
      Without this patch, shouldBeDeferred essentially returns true if
      
        TotalSecondaryCost < IC.getCost()
      
      where TotalSecondaryCost is the total cost of inlining B into As.
      This means that if B is a small wraper function, for example, it would
      get inlined into all of As.  In turn, C gets inlined into all of As.
      In other words, shouldBeDeferred ignores the cost of inlining C into
      each of As.
      
      This patch adds an option, inline-deferral-scale, to replace the
      expression above with:
      
        TotalCost < Allowance
      
      where
      
      - TotalCost is TotalSecondaryCost + IC.getCost() * # of As, and
      - Allowance is IC.getCost() * Scale
      
      For now, the new option defaults to -1, disabling the new scheme.
      
      Reviewers: davidxl
      
      Subscribers: eraman, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79138
      e8984fe6
  30. May 03, 2020
Loading