[PATCH] D127342: [TargetTransformInfo] Added an option for the cache line size

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 13:30:53 PDT 2022


congzhe created this revision.
congzhe added reviewers: bmahjour, fhahn.
congzhe added projects: LLVM, LoopOptWG.
Herald added a subscriber: hiraditya.
Herald added a project: All.
congzhe requested review of this revision.
Herald added a subscriber: llvm-commits.

This patch is to unblock D124926 <https://reviews.llvm.org/D124926>, where the tests needs a valid number of cache line size to proceed with loop cache analysis. However, for some backend targets, `TTIImpl->getCacheLineSize()` is not implemented and hence 'TTI.getCacheLineSize()' would just return 0 and breaks the analysis.

In this patch we add an option for cache line size.  If the option is specified we use the value supplied otherwise, we call `TTIImpl->->getCacheLineSize()` and use the value if it's non zero, or fall-back to the default value in case of zero.

Added a test case under `llvm/test/Analysis/LoopCacheAnalysis` to make sure loop cache analysis produces different but sane costs when a) neither target triple nor option specified and b) option is specified but with a value different from the default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127342

Files:
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/test/Analysis/LoopCacheAnalysis/multi-store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127342.435308.patch
Type: text/x-patch
Size: 6629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220608/918b62eb/attachment.bin>


More information about the llvm-commits mailing list