[all-commits] [llvm/llvm-project] 8045bf: [FuncSpec] Support function specialization across ...

Alexandros Lamprineas via All-commits all-commits at lists.llvm.org
Mon Mar 28 04:08:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8045bf9d0dc5be3a8b8d075fdfe23828f4b7d70e
      https://github.com/llvm/llvm-project/commit/8045bf9d0dc5be3a8b8d075fdfe23828f4b7d70e
  Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
  Date:   2022-03-28 (Mon, 28 Mar 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/SCCPSolver.h
    M llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
    M llvm/lib/Transforms/Utils/SCCPSolver.cpp
    M llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
    A llvm/test/Transforms/FunctionSpecialization/specialize-multiple-arguments.ll

  Log Message:
  -----------
  [FuncSpec] Support function specialization across multiple arguments.

The current implementation of Function Specialization does not allow
specializing more than one arguments per function call, which is a
limitation I am lifting with this patch.

My main challenge was to choose the most suitable ADT for storing the
specializations. We need an associative container for binding all the
actual arguments of a specialization to the function call. We also
need a consistent iteration order across executions. Lastly we want
to be able to sort the entries by Gain and reject the least profitable
ones.

MapVector fits the bill but not quite; erasing elements is expensive
and using stable_sort messes up the indices to the underlying vector.
I am therefore using the underlying vector directly after calculating
the Gain.

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




More information about the All-commits mailing list