aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-04-15 08:01:01 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-04-15 08:01:01 +0000
commit718c46016e9b47d4771a9bda0da34dcc6f149e0a (patch)
treec69fd1fc4cb66f4513f0321b78b2af763ccd4971 /gcc/tree-cfg.c
parentd2994b806914cf8468d9707ded03e2d14e146a88 (diff)
downloadgcc-718c46016e9b47d4771a9bda0da34dcc6f149e0a.zip
gcc-718c46016e9b47d4771a9bda0da34dcc6f149e0a.tar.gz
gcc-718c46016e9b47d4771a9bda0da34dcc6f149e0a.tar.bz2
cfgloop.h (struct loop): Move force_vectorize down.
* cfgloop.h (struct loop): Move force_vectorize down. * gimplify.c (gimple_boolify) <ANNOTATE_EXPR>: Handle new kinds. (gimplify_expr) <ANNOTATE_EXPR>: Minor tweak. * lto-streamer-in.c (input_cfg): Read dont_vectorize field. * lto-streamer-out.c (output_cfg): Write dont_vectorize field. * tree-cfg.c (replace_loop_annotate): Revamp and handle new kinds. * tree-core.h (enum annot_expr_kind): Add new kind values. * tree-inline.c (copy_loops): Copy dont_vectorize field and reorder. * tree-pretty-print.c (dump_generic_node) <ANNOTATE_EXPR>: Handle new kinds. * tree.def (ANNOTATE_EXPR): Tweak comment. ada/ * gcc-interface/trans.c (gnat_gimplify_stmt): Propagate loop hints. From-SVN: r209403
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c82
1 files changed, 47 insertions, 35 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 2f250da..cd35d55 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -250,9 +250,9 @@ build_gimple_cfg (gimple_seq seq)
}
-/* Search for ANNOTATE call with annot_expr_ivdep_kind; if found, remove
- it and set loop->safelen to INT_MAX. We assume that the annotation
- comes immediately before the condition. */
+/* Look for ANNOTATE calls with loop annotation kind; if found, remove
+ them and propagate the information to the loop. We assume that the
+ annotations come immediately before the condition of the loop. */
static void
replace_loop_annotate ()
@@ -266,50 +266,62 @@ replace_loop_annotate ()
{
gsi = gsi_last_bb (loop->header);
stmt = gsi_stmt (gsi);
- if (stmt && gimple_code (stmt) == GIMPLE_COND)
+ if (!(stmt && gimple_code (stmt) == GIMPLE_COND))
+ continue;
+ for (gsi_prev_nondebug (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi))
{
- gsi_prev_nondebug (&gsi);
- if (gsi_end_p (gsi))
- continue;
stmt = gsi_stmt (gsi);
if (gimple_code (stmt) != GIMPLE_CALL)
- continue;
+ break;
if (!gimple_call_internal_p (stmt)
- || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
- continue;
- if ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1))
- != annot_expr_ivdep_kind)
- continue;
+ || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
+ break;
+ switch ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1)))
+ {
+ case annot_expr_ivdep_kind:
+ loop->safelen = INT_MAX;
+ break;
+ case annot_expr_no_vector_kind:
+ loop->dont_vectorize = true;
+ break;
+ case annot_expr_vector_kind:
+ loop->force_vectorize = true;
+ cfun->has_force_vectorize_loops = true;
+ break;
+ default:
+ gcc_unreachable ();
+ }
stmt = gimple_build_assign (gimple_call_lhs (stmt),
gimple_call_arg (stmt, 0));
gsi_replace (&gsi, stmt, true);
- loop->safelen = INT_MAX;
}
}
- /* Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL. */
+ /* Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL. */
FOR_EACH_BB_FN (bb, cfun)
{
- gsi = gsi_last_bb (bb);
- stmt = gsi_stmt (gsi);
- if (stmt && gimple_code (stmt) == GIMPLE_COND)
- gsi_prev_nondebug (&gsi);
- if (gsi_end_p (gsi))
- continue;
- stmt = gsi_stmt (gsi);
- if (gimple_code (stmt) != GIMPLE_CALL)
- continue;
- if (!gimple_call_internal_p (stmt)
- || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
- continue;
- if ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1))
- != annot_expr_ivdep_kind)
- continue;
- warning_at (gimple_location (stmt), 0, "ignoring %<GCC ivdep%> "
- "annotation");
- stmt = gimple_build_assign (gimple_call_lhs (stmt),
- gimple_call_arg (stmt, 0));
- gsi_replace (&gsi, stmt, true);
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
+ {
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_CALL)
+ break;
+ if (!gimple_call_internal_p (stmt)
+ || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
+ break;
+ switch ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1)))
+ {
+ case annot_expr_ivdep_kind:
+ case annot_expr_no_vector_kind:
+ case annot_expr_vector_kind:
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ warning_at (gimple_location (stmt), 0, "ignoring loop annotation");
+ stmt = gimple_build_assign (gimple_call_lhs (stmt),
+ gimple_call_arg (stmt, 0));
+ gsi_replace (&gsi, stmt, true);
+ }
}
}