public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kubaneko/heads/histogram)] fixed loading found another bug
@ 2023-02-23 23:21 Ondrej Kubanek
0 siblings, 0 replies; 3+ messages in thread
From: Ondrej Kubanek @ 2023-02-23 23:21 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:258c38ee4bc8b1dbd7ea2f66ed3c7bf4f91644b2
commit 258c38ee4bc8b1dbd7ea2f66ed3c7bf4f91644b2
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 4fa812fcaba..9cab798f736 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. */
@@ -1516,6 +1542,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 ddc31a82fdc..28686e086bf 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 a0af432b23f..1eca1b79173 100644
--- a/gcc/value-prof.cc
+++ b/gcc/value-prof.cc
@@ -266,7 +266,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,
@@ -276,7 +276,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;
@@ -633,39 +633,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
@@ -701,8 +668,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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/kubaneko/heads/histogram)] fixed loading found another bug
@ 2023-02-16 16:27 Ondrej Kubanek
0 siblings, 0 replies; 3+ messages in thread
From: Ondrej Kubanek @ 2023-02-16 16:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4d451bad79dfe9ccaa0bafca461f65d7c28b720c
commit 4d451bad79dfe9ccaa0bafca461f65d7c28b720c
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/kubaneko/heads/histogram)] fixed loading found another bug
@ 2022-09-28 15:31 Ondrej Kubanek
0 siblings, 0 replies; 3+ messages in thread
From: Ondrej Kubanek @ 2022-09-28 15:31 UTC (permalink / raw)
To: gcc-cvs
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-23 23:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 23:21 [gcc(refs/users/kubaneko/heads/histogram)] fixed loading found another bug Ondrej Kubanek
-- strict thread matches above, loose matches on Subject: below --
2023-02-16 16:27 Ondrej Kubanek
2022-09-28 15:31 Ondrej Kubanek
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).