diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-15 08:01:01 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-15 08:01:01 +0000 |
commit | eb71996d653f229133ef50969b05e1f10826b999 (patch) | |
tree | c69fd1fc4cb66f4513f0321b78b2af763ccd4971 /gcc/tree-cfg.c | |
parent | 363cb5d65cefb244b341d66a4e84cf4a588bb32a (diff) | |
download | gcc-eb71996d653f229133ef50969b05e1f10826b999.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209403 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 2f250da23b6..cd35d559590 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); + } } } |