From: marxin <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 3/3] Enhance dumps of IVOPTS
Date: Fri, 29 Apr 2016 11:58:00 -0000 [thread overview]
Message-ID: <29780c07dc7da0d8f41aa120665072a4098910d8.1461931011.git.mliska@suse.cz> (raw)
In-Reply-To: <cover.1461931011.git.mliska@suse.cz>
gcc/ChangeLog:
2016-04-25 Martin Liska <mliska@suse.cz>
* tree-ssa-loop-ivopts.c (struct ivopts_data): Add inv_expr_map.
(tree_ssa_iv_optimize_init): Initialize it.
(get_expr_id): Assign expressions to the map.
(iv_ca_dump): Dump invariant expressions.
(create_new_ivs): Dump # of inv. expressions and loop niter.
(tree_ssa_iv_optimize_finalize): Release the newly added map.
gcc/testsuite/ChangeLog:
2016-04-29 Martin Liska <mliska@suse.cz>
* g++.dg/tree-ssa/ivopts-3.C: Change test-case to follow
the new format of dump output.
---
gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C | 2 +-
gcc/tree-ssa-loop-ivopts.c | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C b/gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
index 6194e9d..eb72581 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
@@ -72,4 +72,4 @@ int main ( int , char** ) {
// Verify that on x86_64 and i?86 we use a single IV for the innermost loop
-// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
+// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 3 avg niters, 1 expressions, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index af00ff0..52c8184 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -666,6 +666,9 @@ struct ivopts_data
/* The maximum invariant expression id. */
int max_inv_expr_id;
+ /* Dictionary of inv_expr with id used as a key. */
+ vec<iv_inv_expr_ent *> inv_expr_map;
+
/* The bitmap of indices in version_info whose value was changed. */
bitmap relevant;
@@ -1186,6 +1189,7 @@ tree_ssa_iv_optimize_init (struct ivopts_data *data)
data->important_candidates = BITMAP_ALLOC (NULL);
data->max_inv_id = 0;
data->niters = NULL;
+ data->inv_expr_map.create (20);
data->vgroups.create (20);
data->vcands.create (20);
data->inv_expr_tab = new hash_table<iv_inv_expr_hasher> (10);
@@ -4812,6 +4816,12 @@ get_expr_id (struct ivopts_data *data, tree expr)
(*slot)->expr = expr;
(*slot)->hash = ent.hash;
(*slot)->id = data->max_inv_expr_id++;
+
+ unsigned id = (*slot)->id;
+ if (id + 1 >= data->inv_expr_map.length ())
+ data->inv_expr_map.safe_grow (id + 1);
+ data->inv_expr_map[id] = *slot;
+
return (*slot)->id;
}
@@ -6590,6 +6600,20 @@ iv_ca_dump (struct ivopts_data *data, FILE *file, struct iv_ca *ivs)
fprintf (file, "%s%d", pref, i);
pref = ", ";
}
+
+ if (ivs->num_used_inv_expr)
+ {
+ fprintf (dump_file, "\n used invariant expressions:\n");
+ for (int i = 0; i <= data->max_inv_expr_id; i++)
+ if (ivs->used_inv_expr[i])
+ {
+ fprintf (dump_file, " inv_expr:%d: \t", i);
+ print_generic_expr (dump_file, data->inv_expr_map[i]->expr,
+ TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+ }
+
fprintf (file, "\n\n");
}
@@ -7251,6 +7275,9 @@ create_new_ivs (struct ivopts_data *data, struct iv_ca *set)
if (data->loop_loc != UNKNOWN_LOCATION)
fprintf (dump_file, " at %s:%d", LOCATION_FILE (data->loop_loc),
LOCATION_LINE (data->loop_loc));
+ fprintf (dump_file, ", %lu avg niters",
+ avg_loop_niter (data->current_loop));
+ fprintf (dump_file, ", %u expressions", set->num_used_inv_expr);
fprintf (dump_file, ", %lu IVs:\n", bitmap_count_bits (set->cands));
EXECUTE_IF_SET_IN_BITMAP (set->cands, 0, i, bi)
{
@@ -7820,6 +7847,7 @@ tree_ssa_iv_optimize_finalize (struct ivopts_data *data)
BITMAP_FREE (data->important_candidates);
decl_rtl_to_reset.release ();
+ data->inv_expr_map.release ();
data->vgroups.release ();
data->vcands.release ();
delete data->inv_expr_tab;
--
2.8.1
next prev parent reply other threads:[~2016-04-29 11:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 11:58 [PATCH 0/3] IVOPTS: support profiling marxin
2016-04-29 11:58 ` marxin [this message]
2016-05-06 9:19 ` [PATCH 3/3] Enhance dumps of IVOPTS Martin Liška
2016-05-09 9:47 ` Richard Biener
2016-05-10 13:16 ` Bin.Cheng
2016-05-11 14:18 ` Martin Liška
2016-05-12 12:14 ` Martin Liška
2016-05-12 13:51 ` Bin.Cheng
2016-05-12 16:42 ` Martin Liška
2016-05-13 9:43 ` Bin.Cheng
2016-05-13 10:44 ` Martin Liška
2016-05-13 12:12 ` H.J. Lu
2016-05-13 12:39 ` Martin Liška
2016-05-13 12:44 ` Kyrill Tkachov
2016-05-13 12:47 ` Richard Biener
2016-05-13 12:51 ` Martin Liška
2016-05-13 14:17 ` H.J. Lu
2016-05-13 14:46 ` H.J. Lu
2016-04-29 11:58 ` [PATCH 2/3] Add profiling support for IVOPTS marxin
2016-05-16 13:56 ` Martin Liška
2016-05-16 22:27 ` Bin.Cheng
2016-05-19 10:28 ` Martin Liška
2016-05-20 10:04 ` Bin.Cheng
2016-05-24 10:19 ` Bin.Cheng
2016-05-24 10:33 ` Bin.Cheng
2016-05-24 11:01 ` Bin.Cheng
2016-05-30 19:51 ` Martin Liška
2016-04-29 11:58 ` [PATCH 1/3] Encapsulate comp_cost within a class with methods marxin
2016-05-16 10:14 ` Bin.Cheng
2016-05-16 13:55 ` Martin Liška
2016-05-19 10:23 ` Martin Liška
2016-05-19 11:24 ` Bin.Cheng
2016-05-26 21:02 ` Martin Liška
2016-05-03 9:28 ` [PATCH 0/3] IVOPTS: support profiling Bin.Cheng
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=29780c07dc7da0d8f41aa120665072a4098910d8.1461931011.git.mliska@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@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: link
Be 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).