[PATCH] D78635: [NFC][TTI] Add TargetCostKind argument to getUserCost

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 07:00:58 PDT 2020


samparker created this revision.
samparker added reviewers: spatel, lebedev.ri, tejohnson, mtrofin, efriedma, fhahn, RKSimon, arsenm.
Herald added subscribers: kerbowa, asbirlea, zzheng, haicheng, kbarton, hiraditya, eraman, nhaehnle, wdng, jvesely, nemanjai.
Herald added a project: LLVM.

There are several different types of cost that TTI tries to provide explicit information for: throughput, latency, code size along with a vague 'intersection of code-size cost and execution cost'.
The vectorizer is a keen user of RecipThroughput and there's at least 'getInstructionThroughput' and 'getArithmeticInstrCost' designed to help with this cost. The latency cost has a single use and a single implementation. The intersection cost appears to cover most of the rest of the API.
getUserCost is explicitly called from within TTI when the user has been explicit in wanting the code size (also only one use) as well as a few passes which are concerned with a mixture of size and/or a relative cost. In many cases these costs are closely related, such as when multiple instructions are required, but one evident diverging cost in this function is for div/rem.
This patch adds an argument so that the cost required is explicit, so that we can make the important distinction when necessary.
Next, I'd like to combine getUserCost and getInstructionCost.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78635

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/lib/Analysis/CodeMetrics.cpp
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
  llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
  llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.h
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/lib/Transforms/Scalar/SpeculateAroundPHIs.cpp
  llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78635.259265.patch
Type: text/x-patch
Size: 21125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/bfe592ff/attachment.bin>


More information about the llvm-commits mailing list