[PATCH] D91957: [Analysis] Migrate more high level cost functions to using InstructionCost

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 04:54:08 PST 2020


david-arm created this revision.
Herald added subscribers: llvm-commits, zzheng, kbarton, hiraditya, nemanjai.
Herald added a project: LLVM.
david-arm requested review of this revision.

This patch changes the following TargetTransformInfo interfaces to
return a InstructionCost class:

  getUserCost
  getInstructionLatency
  getInstructionThroughput

As a result of changing getUserCost I have also had to fix up various
places where it is called. One example of this is in the CodeMetrics
class where the NumInsts field has been changed to InstructionCost.
If an invalid cost is encountered while analyzing a block we set the
notDuplicatable flag, and in addition certain places need to check
that NumInsts is valid.

In SimplifyCFG.cpp I have changed the code to ensure that we bail out
if trying to subtract an invalid cost.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91957

Files:
  llvm/include/llvm/Analysis/CodeMetrics.h
  llvm/include/llvm/Analysis/InstructionCost.h
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Transforms/Utils/LoopRotationUtils.h
  llvm/lib/Analysis/CodeMetrics.cpp
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
  llvm/lib/Transforms/Scalar/LoopFlatten.cpp
  llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
  llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/lib/Transforms/Scalar/SpeculateAroundPHIs.cpp
  llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
  llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91957.307044.patch
Type: text/x-patch
Size: 23621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201123/7a7d6ac4/attachment.bin>


More information about the llvm-commits mailing list