summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-03-18 00:27:43 +0000
committerAdam Nemet <anemet@apple.com>2016-03-18 00:27:43 +0000
commit709e3046ee3c473b373fe5ec61e4d6e467991898 (patch)
tree48c80521787e640be1608d9991f919853facfb6f /llvm/lib/Target
parent6d8beeca5302984e845d9c6d7bf0a9e4a5ca98f9 (diff)
downloadbcm5719-llvm-709e3046ee3c473b373fe5ec61e4d6e467991898.tar.gz
bcm5719-llvm-709e3046ee3c473b373fe5ec61e4d6e467991898.zip
[LoopDataPrefetch] Add TTI to limit the number of iterations to prefetch ahead
Summary: It can hurt performance to prefetch ahead too much. Be conservative for now and don't prefetch ahead more than 3 iterations on Cyclone. Reviewers: hfinkel Subscribers: llvm-commits, mzolotukhin Differential Revision: http://reviews.llvm.org/D17949 llvm-svn: 263772
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp13
-rw-r--r--llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index aee298998f3..2b3fae958f4 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -31,6 +31,13 @@ static cl::opt<unsigned> CycloneMinPrefetchStride(
cl::desc("Min stride to add prefetches for Cyclone"),
cl::init(2048), cl::Hidden);
+// Be conservative for now and don't prefetch ahead too much since the loop
+// may terminate early.
+static cl::opt<unsigned> CycloneMaxPrefetchIterationsAhead(
+ "cyclone-max-prefetch-iters-ahead",
+ cl::desc("Max number of iterations to prefetch ahead on Cyclone"),
+ cl::init(3), cl::Hidden);
+
/// \brief Calculate the cost of materializing a 64-bit value. This helper
/// method might only calculate a fraction of a larger immediate. Therefore it
/// is valid to return a cost of ZERO.
@@ -602,3 +609,9 @@ unsigned AArch64TTIImpl::getMinPrefetchStride() {
return CycloneMinPrefetchStride;
return BaseT::getMinPrefetchStride();
}
+
+unsigned AArch64TTIImpl::getMaxPrefetchIterationsAhead() {
+ if (ST->isCyclone())
+ return CycloneMaxPrefetchIterationsAhead;
+ return BaseT::getMaxPrefetchIterationsAhead();
+}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index a54db00e7d3..93a84b7a992 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -133,6 +133,8 @@ public:
unsigned getPrefetchDistance();
unsigned getMinPrefetchStride();
+
+ unsigned getMaxPrefetchIterationsAhead();
/// @}
};
OpenPOWER on IntegriCloud