diff options
| author | Adam Nemet <anemet@apple.com> | 2016-03-07 18:35:42 +0000 |
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2016-03-07 18:35:42 +0000 |
| commit | bb3680bd8590b2dd817bbbb482badd6ebcbe6224 (patch) | |
| tree | db6dcd6f9e10ef6a924b7ee4ab8172529ab3d854 /llvm/lib/Transforms/Scalar | |
| parent | 5f5de9f89b3602d9ca323c0512e8dc8163f7b393 (diff) | |
| download | bcm5719-llvm-bb3680bd8590b2dd817bbbb482badd6ebcbe6224.tar.gz bcm5719-llvm-bb3680bd8590b2dd817bbbb482badd6ebcbe6224.zip | |
[LoopDataPrefetch] If prefetch distance is not set, skip pass
This lets select sub-targets enable this pass. The patch implements the
idea from the recent llvm-dev thread:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/94925
The goal is to enable the LoopDataPrefetch pass for the Cyclone
sub-target only within Aarch64.
Positive and negative tests will be included in an upcoming patch that
enables selective prefetching of large-strided accesses on Cyclone.
llvm-svn: 262844
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp index 0edceec8e13..5d0a5906509 100644 --- a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp @@ -99,9 +99,12 @@ bool LoopDataPrefetch::runOnFunction(Function &F) { AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); + // If PrefetchDistance is not set, don't run the pass. This gives an + // opportunity for targets to run this pass for selected subtargets only + // (whose TTI sets PrefetchDistance). + if (TTI->getPrefetchDistance() == 0) + return false; assert(TTI->getCacheLineSize() && "Cache line size is not set for target"); - assert(TTI->getPrefetchDistance() && - "Prefetch distance is not set for target"); bool MadeChange = false; |

