Add debug counter for loop array prefetching.
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Tue, 6 Jun 2017 17:00:46 +0000 (17:00 +0000)
committerMaxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>
Tue, 6 Jun 2017 17:00:46 +0000 (17:00 +0000)
* dbgcnt.def (prefetch): New debug counter.
* tree-ssa-loop-prefetch.c (dbgcnt.h): New include.
(schedule_prefetches): Stop issueing prefetches if debug counter
tripped.

Change-Id: Ia6160364735a889fb6d2370be21d98f87c0fe962

From-SVN: r248924

gcc/ChangeLog
gcc/dbgcnt.def
gcc/tree-ssa-loop-prefetch.c

index 5dd00df1af06f5990ee42f9adc37029bf8c1c572..c4801f0c97cce5ffde479ecce7bf01ba45d8a795 100644 (file)
@@ -1,3 +1,10 @@
+2017-06-06  Maxim Kuvyrkov  <maxim.kuvyrkov@linaro.org>
+
+        * dbgcnt.def (prefetch): New debug counter.
+        * tree-ssa-loop-prefetch.c (dbgcnt.h): New include.
+        (schedule_prefetches): Stop issueing prefetches if debug counter
+        tripped.
+
 2017-06-06  Tom de Vries  <tom@codesourcery.com>
 
        * doc/sourcebuild.texi (Testsuites, C Language Testsuites,
index ded20e02ac36ba3fd4c1e1266f371ad51f981591..6c6350836f9654b9955744531d1104699556703d 100644 (file)
@@ -174,6 +174,7 @@ DEBUG_COUNTER (merged_ipa_icf)
 DEBUG_COUNTER (postreload_cse)
 DEBUG_COUNTER (pre)
 DEBUG_COUNTER (pre_insn)
+DEBUG_COUNTER (prefetch)
 DEBUG_COUNTER (registered_jump_thread)
 DEBUG_COUNTER (sched2_func)
 DEBUG_COUNTER (sched_block)
index f5f2802e5b93a527144dd5b19bc5f37ace8e822a..60101417a4e36a1999a10264e1a2b87e4af09528 100644 (file)
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-inline.h"
 #include "tree-data-ref.h"
 #include "diagnostic-core.h"
+#include "dbgcnt.h"
 
 /* This pass inserts prefetch instructions to optimize cache usage during
    accesses to arrays in loops.  It processes loops sequentially and:
@@ -1058,6 +1059,10 @@ schedule_prefetches (struct mem_ref_group *groups, unsigned unroll_factor,
        if (2 * remaining_prefetch_slots < prefetch_slots)
          continue;
 
+       /* Stop prefetching if debug counter is activated.  */
+       if (!dbg_cnt (prefetch))
+         continue;
+
        ref->issue_prefetch_p = true;
 
        if (remaining_prefetch_slots <= prefetch_slots)