aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-prefetch.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-03-03 12:53:56 +0100
committerMartin Liska <marxin@gcc.gnu.org>2017-03-03 11:53:56 +0000
commitd78a1c01dbb859cb406ffdea3bc2ced2963cae9a (patch)
tree819e4d40f5b3dd8e071eb7d0b6bab9fc6953394a /gcc/tree-ssa-loop-prefetch.c
parentec7f796e87db1b01ce4fbaabc6f0d73000ad4001 (diff)
downloadgcc-d78a1c01dbb859cb406ffdea3bc2ced2963cae9a.zip
gcc-d78a1c01dbb859cb406ffdea3bc2ced2963cae9a.tar.gz
gcc-d78a1c01dbb859cb406ffdea3bc2ced2963cae9a.tar.bz2
Add -Wdisabled-optimization to loop prefetching pass (PR tree-optimization/79803).
2017-03-03 Martin Liska <mliska@suse.cz> PR tree-optimization/79803 * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Remove assert. (pass_loop_prefetch::execute): Disabled optimization if an assumption about L1 cache size is not met. 2017-03-03 Martin Liska <mliska@suse.cz> PR tree-optimization/79803 * gcc.dg/tree-ssa/pr79803.c: New test. From-SVN: r245869
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
-rw-r--r--gcc/tree-ssa-loop-prefetch.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 54cd942..a137207 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "tree-inline.h"
#include "tree-data-ref.h"
+#include "diagnostic-core.h"
/* This pass inserts prefetch instructions to optimize cache usage during
accesses to arrays in loops. It processes loops sequentially and:
@@ -1977,10 +1978,6 @@ tree_ssa_prefetch_arrays (void)
set_builtin_decl (BUILT_IN_PREFETCH, decl, false);
}
- /* We assume that size of cache line is a power of two, so verify this
- here. */
- gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0);
-
FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2038,6 +2035,21 @@ pass_loop_prefetch::execute (function *fun)
if (number_of_loops (fun) <= 1)
return 0;
+ bool warned_p = false;
+ if ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) != 0)
+ {
+ static bool warned = false;
+
+ if (!warned)
+ {
+ warning (OPT_Wdisabled_optimization,
+ "%<l1-cache-size%> parameter is not a power of two %d",
+ PREFETCH_BLOCK);
+ warned = true;
+ }
+ return 0;
+ }
+
return tree_ssa_prefetch_arrays ();
}