From: Maxim Kuvyrkov Date: Tue, 6 Jun 2017 17:00:46 +0000 (+0000) Subject: Add debug counter for loop array prefetching. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a70c8d54274226d5613569fe7df134f882a0263;p=gcc.git Add debug counter for loop array prefetching. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5dd00df1af0..c4801f0c97c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-06-06 Maxim Kuvyrkov + + * 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 * doc/sourcebuild.texi (Testsuites, C Language Testsuites, diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index ded20e02ac3..6c6350836f9 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -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) diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index f5f2802e5b9..60101417a4e 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -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)