[all-commits] [llvm/llvm-project] dbeaf6: [FuncSpec] Do not overestimate the specialization ...

Alexandros Lamprineas via All-commits all-commits at lists.llvm.org
Thu Oct 27 07:40:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dbeaf6baa2ad12112e7092f5814396f444733958
      https://github.com/llvm/llvm-project/commit/dbeaf6baa2ad12112e7092f5814396f444733958
  Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
    M llvm/test/Transforms/FunctionSpecialization/function-specialization-loop.ll

  Log Message:
  -----------
  [FuncSpec] Do not overestimate the specialization bonus for users inside loops.

When calculating the specialization bonus for a given function argument,
we recursively traverse the chain of (certain) users, accumulating the
instruction costs. Then we exponentially increase the bonus to account
for loop nests. This is problematic for two reasons: (a) the users might
not themselves be inside the loop nest, (b) if they are we are accounting
for it multiple times. Instead we should be adjusting the bonus before
traversing the user chain.

This reduces the instruction count for CTMark (newPM-O3) when Function
Specialization is enabled without actually reducing the amount of
specializations performed (geomean: -0.001% non-LTO, -0.406% LTO).

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




More information about the All-commits mailing list