[PATCH] D68804: [System Model] [TTI] Move default cache/prefetch implementations
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 13:46:31 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c562f12869f: [System Model] [TTI] Move default cache/prefetch implementations (authored by greened).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68804/new/
https://reviews.llvm.org/D68804
Files:
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
Index: llvm/lib/Analysis/TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Analysis/TargetTransformInfo.cpp
+++ llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -40,34 +40,6 @@
struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
explicit NoTTIImpl(const DataLayout &DL)
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
-
- unsigned getCacheLineSize() const { return 0; }
-
- llvm::Optional<unsigned> getCacheSize(TargetTransformInfo::CacheLevel Level) const {
- switch (Level) {
- case TargetTransformInfo::CacheLevel::L1D:
- LLVM_FALLTHROUGH;
- case TargetTransformInfo::CacheLevel::L2D:
- return llvm::Optional<unsigned>();
- }
- llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
- }
-
- llvm::Optional<unsigned> getCacheAssociativity(
- TargetTransformInfo::CacheLevel Level) const {
- switch (Level) {
- case TargetTransformInfo::CacheLevel::L1D:
- LLVM_FALLTHROUGH;
- case TargetTransformInfo::CacheLevel::L2D:
- return llvm::Optional<unsigned>();
- }
-
- llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
- }
-
- unsigned getPrefetchDistance() const { return 0; }
- unsigned getMinPrefetchStride() const { return 1; }
- unsigned getMaxPrefetchIterationsAhead() const { return UINT_MAX; }
};
}
Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -523,8 +523,13 @@
virtual Optional<unsigned>
getCacheAssociativity(TargetTransformInfo::CacheLevel Level) const {
- return Optional<unsigned>(
- getST()->getCacheAssociativity(static_cast<unsigned>(Level)));
+ Optional<unsigned> TargetResult =
+ getST()->getCacheAssociativity(static_cast<unsigned>(Level));
+
+ if (TargetResult)
+ return TargetResult;
+
+ return BaseT::getCacheAssociativity(Level);
}
virtual unsigned getCacheLineSize() const {
Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -371,6 +371,34 @@
return false;
}
+ unsigned getCacheLineSize() const { return 0; }
+
+ llvm::Optional<unsigned> getCacheSize(TargetTransformInfo::CacheLevel Level) const {
+ switch (Level) {
+ case TargetTransformInfo::CacheLevel::L1D:
+ LLVM_FALLTHROUGH;
+ case TargetTransformInfo::CacheLevel::L2D:
+ return llvm::Optional<unsigned>();
+ }
+ llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
+ }
+
+ llvm::Optional<unsigned> getCacheAssociativity(
+ TargetTransformInfo::CacheLevel Level) const {
+ switch (Level) {
+ case TargetTransformInfo::CacheLevel::L1D:
+ LLVM_FALLTHROUGH;
+ case TargetTransformInfo::CacheLevel::L2D:
+ return llvm::Optional<unsigned>();
+ }
+
+ llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
+ }
+
+ unsigned getPrefetchDistance() const { return 0; }
+ unsigned getMinPrefetchStride() const { return 1; }
+ unsigned getMaxPrefetchIterationsAhead() const { return UINT_MAX; }
+
unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68804.224466.patch
Type: text/x-patch
Size: 3437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191010/893ff089/attachment.bin>
More information about the llvm-commits
mailing list