public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ondrej Kubanek <kubaneko@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] fixed loading found another bug Date: Wed, 28 Sep 2022 15:31:00 +0000 (GMT) [thread overview] Message-ID: <20220928153100.8730F3857B95@sourceware.org> (raw) https://gcc.gnu.org/g:fb1024482c3af33773dd596f884ee04911a16bf9 commit fb1024482c3af33773dd596f884ee04911a16bf9 Author: kubaneko <kubanek0ondrej@gmail.com> Date: Mon Sep 26 21:51:35 2022 +0000 fixed loading found another bug Diff: --- gcc/profile.cc | 33 +++++++++++++++++++++++++++++++++ gcc/tree-ssa-loop-ivcanon.cc | 2 +- gcc/value-prof.cc | 40 +++------------------------------------- 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/gcc/profile.cc b/gcc/profile.cc index b9c355f2030..987b764baf5 100644 --- a/gcc/profile.cc +++ b/gcc/profile.cc @@ -919,6 +919,31 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, bool topn_p = (hist->type == HIST_TYPE_TOPN_VALUES || hist->type == HIST_TYPE_INDIR_CALL); + + /* Histogram profiler counter is not related to any statement, + so that we have to read the counter and set the value to + the corresponding loop */ + + if (hist->type == HIST_TYPE_HISTOGRAM) + { + printf("tata"); + auto lp = hist->hvalue.lp; + if (act_count[t]){ + if (lp->valid_hist) + { + for (int i=0;i<69;++i){ + lp->hist[i]+=act_count[t][i]; + } + } else { + lp->valid_hist = true; + for (int i=0;i<69;++i){ + lp->hist[i]=act_count[t][i]; + } + } + } + continue; + } + /* TOP N counter uses variable number of counters. */ if (topn_p) { @@ -954,6 +979,7 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, hist->hvalue.counters[j] = 0; } + /* Time profiler counter is not related to any statement, so that we have to read the counter and set the value to the corresponding call graph node. */ @@ -1514,6 +1540,13 @@ branch_prob (bool thunk) compute_value_histograms (values, cfg_checksum, lineno_checksum); } + for (auto loop : loops_list (cfun, 0)){ + printf("fasdfasdfasdf"); + if (loop->valid_hist){ + printf("%ld %ld %ld %ld", loop->hist[0], loop->hist[1], loop->hist[2], loop->hist[3]); + } + } + remove_fake_edges (); /* For each edge not on the spanning tree, add counting code. */ diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc index 766bffa0274..2454600d138 100644 --- a/gcc/tree-ssa-loop-ivcanon.cc +++ b/gcc/tree-ssa-loop-ivcanon.cc @@ -1162,6 +1162,7 @@ canonicalize_loop_induction_variables (class loop *loop, bool create_iv, enum unroll_level ul, bool try_eval, bool allow_peel) { + edge exit = NULL; tree niter; HOST_WIDE_INT maxiter; @@ -1273,7 +1274,6 @@ canonicalize_loop_induction_variables (class loop *loop, if (iv_niter) create_canonical_iv (loop, exit, iv_niter); } - if (ul == UL_ALL) modified |= try_peel_loop (loop, exit, niter, may_be_zero, maxiter); diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc index fe3d87a3108..c4dbd0226b5 100644 --- a/gcc/value-prof.cc +++ b/gcc/value-prof.cc @@ -267,7 +267,7 @@ dump_histogram_value (FILE *dump_file, histogram_value hist) break; case HIST_TYPE_HISTOGRAM: if (hist->hvalue.counters){ - for (int i=0; i<8; ++i){ + for (int i=0; i<=8; ++i){ fprintf (dump_file, "Histogram counter histogram%" PRId64 ":%" PRId64 ".\n", (int64_t) i, @@ -277,7 +277,7 @@ dump_histogram_value (FILE *dump_file, histogram_value hist) fprintf (dump_file, "Histogram counter histogram%" PRId64 ":%" PRId64 ".\n", (int64_t) 1>>i, - (int64_t) hist->hvalue.counters[4+i]); + (int64_t) hist->hvalue.counters[5+i]); } } break; @@ -634,39 +634,6 @@ check_counter (gimple *stmt, const char * name, return false; } -static bool -gimple_loop_histogram_transform (gimple_stmt_iterator *si) -{ - histogram_value histogram; - gassign *stmt; - - stmt = dyn_cast <gassign *> (gsi_stmt (*si)); - histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_HISTOGRAM); - debug_gimple_stmt (stmt); - if (!histogram) - return false; - - gcov_type *counter = histogram->hvalue.counters; - auto lp = histogram->hvalue.lp; - - if (lp->valid_hist){ - for (int i=0;i<69;++i){ - lp->hist[i]+=counter[i]; - } - } else { - lp->valid_hist = true; - for (int i=0;i<69;++i){ - lp->hist[i]=counter[i]; - } - } - - gimple_remove_histogram_value (cfun, stmt, histogram); - - update_stmt (gsi_stmt (*si)); - - return true; -} - /* GIMPLE based transformations. */ bool @@ -702,8 +669,7 @@ gimple_value_profile_transformations (void) if (gimple_mod_subtract_transform (&gsi) || gimple_divmod_fixed_value_transform (&gsi) || gimple_mod_pow2_value_transform (&gsi) - || gimple_stringops_transform (&gsi) - || gimple_loop_histogram_transform (&gsi)) + || gimple_stringops_transform (&gsi)) { stmt = gsi_stmt (gsi); changed = true;
next reply other threads:[~2022-09-28 15:31 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-28 15:31 Ondrej Kubanek [this message] 2023-02-16 16:27 Ondrej Kubanek 2023-02-23 23:21 Ondrej Kubanek
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=20220928153100.8730F3857B95@sourceware.org \ --to=kubaneko@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).