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)] add loop_optimizer_init
Date: Thu, 16 Feb 2023 16:27:45 +0000 (GMT)	[thread overview]
Message-ID: <20230216162745.D6E323858C60@sourceware.org> (raw)

https://gcc.gnu.org/g:77959cb79b046bb7912e5c36c37d2f0fe1eedaa2

commit 77959cb79b046bb7912e5c36c37d2f0fe1eedaa2
Author: kubaneko <kubanek0ondrej@gmail.com>
Date:   Tue Sep 27 12:47:59 2022 +0000

    add loop_optimizer_init

Diff:
---
 gcc/profile.cc    | 5 +++++
 gcc/value-prof.cc | 5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/profile.cc b/gcc/profile.cc
index 987b764baf5..297f335a439 100644
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -1206,6 +1206,9 @@ branch_prob (bool thunk)
 
   total_num_times_called++;
 
+  calculate_dominance_info (CDI_DOMINATORS);
+  loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES);
+
   flow_call_edges_add (NULL);
   add_noreturn_fake_exit_edges ();
 
@@ -1591,6 +1594,8 @@ branch_prob (bool thunk)
 	  }
       compute_function_frequency ();
     }
+   loop_optimizer_finalize ();
+   free_dominance_info (CDI_DOMINATORS);
 }
 \f
 /* Union find algorithm implementation for the basic blocks using
diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc
index c4dbd0226b5..fad7967a869 100644
--- a/gcc/value-prof.cc
+++ b/gcc/value-prof.cc
@@ -1930,11 +1930,11 @@ gimple_stringops_values_to_profile (gimple *gs, histogram_values *values)
 
 static void
 gimple_histogram_values_to_profile(function *fun, histogram_values * values){
-    calculate_dominance_info (CDI_DOMINATORS);
     for (auto loop : loops_list (fun, 0)){
          tree var;
          gimple_stmt_iterator gsi;
-         gsi = gsi_last_bb (loop->latch);
+         
+         gsi = gsi_start_bb (loop->latch);
          create_iv (build_int_cst_type (get_gcov_type(), 0), build_int_cst (get_gcov_type(), 1), NULL_TREE,
              loop, &gsi, true, &var, NULL);
          auto_vec<edge> exits = get_loop_exit_edges (loop);
@@ -1946,7 +1946,6 @@ gimple_histogram_values_to_profile(function *fun, histogram_values * values){
                  }
          }
     }
-    free_dominance_info (CDI_DOMINATORS);
     gsi_commit_edge_inserts ();
 }

             reply	other threads:[~2023-02-16 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 16:27 Ondrej Kubanek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-23 23:21 Ondrej Kubanek
2022-09-28 15:31 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=20230216162745.D6E323858C60@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: 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).