public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/107925] ICE in update_specialized_profile at gcc/ipa-cp.cc:5082 for 531.deepsjeng_r benchmark
Date: Fri, 17 Feb 2023 17:20:58 +0000	[thread overview]
Message-ID: <bug-107925-4-BoRppvIeBD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107925-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107925

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jamborm at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The assert is bogus, the "new" division of unexplained counts in the
case of recursive functions so it can easily happen that what is left
is less than what we're trying to take away.  Having said that, there
are a few more issues with the function, chief among them not dropping
potentially guessed profiles to ipa.

I'm going to test the following:

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 4b8dedc0c51..5a6b41cf2d6 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -5093,22 +5093,24 @@ update_specialized_profile (struct cgraph_node
*new_node,
                            profile_count redirected_sum)
 { 
   struct cgraph_edge *cs;
-  profile_count new_node_count, orig_node_count = orig_node->count;
+  profile_count new_node_count, orig_node_count = orig_node->count.ipa ();

   if (dump_file)
     { 
       fprintf (dump_file, "    the sum of counts of redirected  edges is ");
       redirected_sum.dump (dump_file);
+      fprintf (dump_file, "\n    old ipa count of the original node is ");
+      orig_node_count.dump (dump_file);
       fprintf (dump_file, "\n");
     }
   if (!(orig_node_count > profile_count::zero ()))
     return;

-  gcc_assert (orig_node_count >= redirected_sum);
-  
   new_node_count = new_node->count;
   new_node->count += redirected_sum;
-  orig_node->count -= redirected_sum;
+  orig_node->count
+    = lenient_count_portion_handling (orig_node->count - redirected_sum,
+                                     orig_node);

   for (cs = new_node->callees; cs; cs = cs->next_callee)
     cs->count += cs->count.apply_scale (redirected_sum, new_node_count);

  parent reply	other threads:[~2023-02-17 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 20:46 [Bug ipa/107925] New: " marxin at gcc dot gnu.org
2022-11-29 20:46 ` [Bug ipa/107925] " marxin at gcc dot gnu.org
2022-11-29 20:46 ` marxin at gcc dot gnu.org
2022-11-29 20:47 ` marxin at gcc dot gnu.org
2022-11-29 20:58 ` pinskia at gcc dot gnu.org
2023-01-27 10:15 ` tnfchris at gcc dot gnu.org
2023-02-17 17:20 ` jamborm at gcc dot gnu.org [this message]
2023-02-22  9:55 ` jamborm at gcc dot gnu.org
2023-03-14 17:57 ` cvs-commit at gcc dot gnu.org
2023-03-14 17:57 ` cvs-commit at gcc dot gnu.org
2023-03-14 17:58 ` jamborm at gcc dot gnu.org
2023-03-22 16:05 ` cvs-commit at gcc dot gnu.org
2023-03-22 16:06 ` jamborm at gcc dot gnu.org

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=bug-107925-4-BoRppvIeBD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).