public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5491] Avoid redundant get_loop_body calls in IVOPTs Date: Wed, 24 Nov 2021 08:03:22 +0000 (GMT) [thread overview] Message-ID: <20211124080322.5B49F3858429@sourceware.org> (raw) https://gcc.gnu.org/g:52554dde7bf625c66192504cef01890bacc79694 commit r12-5491-g52554dde7bf625c66192504cef01890bacc79694 Author: Richard Biener <rguenther@suse.de> Date: Tue Nov 23 13:51:10 2021 +0100 Avoid redundant get_loop_body calls in IVOPTs This removes redundant get_loop_body calls in IVOPTs by passing around the body we're gathering early. 2021-11-23 Richard Biener <rguenther@suse.de> * tree-ssa-loop-ivopts.c (find_givs): Take loop body as argument instead of re-computing it. (find_interesting_uses): Likewise. (find_induction_variables): Pass through loop body. (tree_ssa_iv_optimize_loop): Pass down loop body. Diff: --- gcc/tree-ssa-loop-ivopts.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 5a7fd305d91..4769b65b5d3 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1462,22 +1462,20 @@ find_givs_in_bb (struct ivopts_data *data, basic_block bb) /* Finds general ivs. */ static void -find_givs (struct ivopts_data *data) +find_givs (struct ivopts_data *data, basic_block *body) { class loop *loop = data->current_loop; - basic_block *body = get_loop_body_in_dom_order (loop); unsigned i; for (i = 0; i < loop->num_nodes; i++) find_givs_in_bb (data, body[i]); - free (body); } /* For each ssa name defined in LOOP determines whether it is an induction variable and if so, its initial value and step. */ static bool -find_induction_variables (struct ivopts_data *data) +find_induction_variables (struct ivopts_data *data, basic_block *body) { unsigned i; bitmap_iterator bi; @@ -1485,7 +1483,7 @@ find_induction_variables (struct ivopts_data *data) if (!find_bivs (data)) return false; - find_givs (data); + find_givs (data, body); mark_bivs (data); if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2736,11 +2734,10 @@ split_address_groups (struct ivopts_data *data) /* Finds uses of the induction variables that are interesting. */ static void -find_interesting_uses (struct ivopts_data *data) +find_interesting_uses (struct ivopts_data *data, basic_block *body) { basic_block bb; gimple_stmt_iterator bsi; - basic_block *body = get_loop_body (data->current_loop); unsigned i; edge e; @@ -2760,7 +2757,6 @@ find_interesting_uses (struct ivopts_data *data) if (!is_gimple_debug (gsi_stmt (bsi))) find_interesting_uses_stmt (data, gsi_stmt (bsi)); } - free (body); split_address_groups (data); @@ -8077,11 +8073,11 @@ tree_ssa_iv_optimize_loop (struct ivopts_data *data, class loop *loop, /* For each ssa name determines whether it behaves as an induction variable in some loop. */ - if (!find_induction_variables (data)) + if (!find_induction_variables (data, body)) goto finish; /* Finds interesting uses (item 1). */ - find_interesting_uses (data); + find_interesting_uses (data, body); if (data->vgroups.length () > MAX_CONSIDERED_GROUPS) goto finish;
reply other threads:[~2021-11-24 8:03 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=20211124080322.5B49F3858429@sourceware.org \ --to=rguenth@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).