[all-commits] [llvm/llvm-project] 4ffc3c: [CostModel] Templatize EntryCost::Cost to allow cu...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Jul 20 07:37:18 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ffc3c3726e9fd2fd1be80983d7f0fbbf5a7572c
      https://github.com/llvm/llvm-project/commit/4ffc3c3726e9fd2fd1be80983d7f0fbbf5a7572c
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-07-20 (Tue, 20 Jul 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/CostTable.h

  Log Message:
  -----------
  [CostModel] Templatize EntryCost::Cost to allow custom cost metrics

We currently use an unsigned value for our CostTblEntry and TypeConversionCostTblEntry cost tables which is limiting depending on how the target wishes to handle various CostKinds etc.

For instance, targets might wish to store separate instruction count, latency or throughput values etc. On D46276 we have been investigating storing a code snippet to improve latency/throughput cost calculations.

There is a slight problem in that template argument deduction was struggling to match the now templatized Costs[] tables in a ArrayRef constructor - I've added helper wrappers for CostTableLookup/ConvertCostTableLookup which avoids us having to update all existing calls with a template hint.

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




More information about the All-commits mailing list