[llvm] r262844 - [LoopDataPrefetch] If prefetch distance is not set, skip pass

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 10:35:42 PST 2016


Author: anemet
Date: Mon Mar  7 12:35:42 2016
New Revision: 262844

URL: http://llvm.org/viewvc/llvm-project?rev=262844&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopDataPrefetch.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopDataPrefetch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDataPrefetch.cpp?rev=262844&r1=262843&r2=262844&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDataPrefetch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDataPrefetch.cpp Mon Mar  7 12:35:42 2016
@@ -99,9 +99,12 @@ bool LoopDataPrefetch::runOnFunction(Fun
   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;
 




More information about the llvm-commits mailing list