public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] Add comments, fix various tweaks. Date: Mon, 29 Nov 2021 11:13:44 +0000 (GMT) [thread overview] Message-ID: <20211129111344.7125E3877411@sourceware.org> (raw) https://gcc.gnu.org/g:5b3da0045f3f572ec55ab7c48ec95d3753c4fe02 commit 5b3da0045f3f572ec55ab7c48ec95d3753c4fe02 Author: Martin Liska <mliska@suse.cz> Date: Mon Nov 29 11:55:43 2021 +0100 Add comments, fix various tweaks. Diff: --- gcc/tree-ssa-loop-unswitch.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 1d5bcfc3237..a41c25784f3 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -95,10 +95,13 @@ struct unswitch_predicate int_range_max false_range; }; +/* Cache storage for unswitch_predicate belonging to a basic block. */ static vec<vec<unswitch_predicate *>> *bb_predicates = NULL; +/* Ranger instance used in the pass. */ static gimple_ranger *ranger = NULL; +/* The type represents a predicate path leading to a basic block. */ typedef auto_vec<std::pair<unswitch_predicate *, bool>> predicate_vector; static class loop *tree_unswitch_loop (class loop *, basic_block, tree); @@ -115,6 +118,8 @@ static void hoist_guard (class loop *, edge); static bool check_exit_phi (class loop *); static tree get_vop_from_header (class loop *); +/* Return vector of predicates that belong to a basic block. */ + static vec<unswitch_predicate *> & get_predicates_for_bb (basic_block bb) { @@ -122,6 +127,8 @@ get_predicates_for_bb (basic_block bb) return (*bb_predicates)[last == NULL ? 0 : gimple_uid (last)]; } +/* Save predicates that belong to a basic block. */ + static void set_predicates_for_bb (basic_block bb, vec<unswitch_predicate *> predicates) { @@ -129,6 +136,8 @@ set_predicates_for_bb (basic_block bb, vec<unswitch_predicate *> predicates) bb_predicates->safe_push (predicates); } +/* Initialize LOOP information reused during the unswitching pass. */ + static void init_loop_unswitch_info (class loop *loop) { @@ -193,7 +202,9 @@ tree_ssa_unswitch_loops (void) changed |= tree_unswitch_outer_loop (loop); } + disable_ranger (cfun); + clear_aux_for_blocks (); if (changed) return TODO_cleanup_cfg; @@ -366,7 +377,8 @@ combine_range (predicate_vector &predicate_path, tree index, irange &path_range) Utilize both symbolic expressions and value ranges calculated by Ranger. */ static tree -simplify_using_entry_checks (gimple *stmt, predicate_vector &predicate_path) +evaluate_control_stmt_using_entry_checks (gimple *stmt, + predicate_vector &predicate_path) { if (predicate_path.is_empty ()) return NULL_TREE; @@ -415,7 +427,8 @@ simplify_loop_version (class loop *loop, predicate_vector &predicate_path) { gimple *stmt = last_stmt (bbs[i]); - tree folded = simplify_using_entry_checks (stmt, predicate_path); + tree folded = evaluate_control_stmt_using_entry_checks (stmt, + predicate_path); if (folded != NULL_TREE) { /* Remove path. */ @@ -475,7 +488,8 @@ evaluate_insns (class loop *loop, basic_block *bbs, if (predicate != NULL) { tree folded - = simplify_using_entry_checks (cond, predicate_path); + = evaluate_control_stmt_using_entry_checks (cond, + predicate_path); if (folded == boolean_true_node) flags = EDGE_FALSE_VALUE; else if (folded == boolean_false_node)
reply other threads:[~2021-11-29 11:13 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211129111344.7125E3877411@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).