public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/111601] [14 Regression] profilebootstrap fails in stagestrain in libcody on x86_64-linux-gnu and powerpc64le-linux-gnu
Date: Mon, 27 Nov 2023 18:33:55 +0000	[thread overview]
Message-ID: <bug-111601-4-Q25idew5XY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111601-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase (though, just the function in question, not a runable
testcase):
struct tree_base
{
  int code:16;
};
struct saved_scope
{
  void *pad[14];
  int x_processing_template_decl;
};
extern struct saved_scope *scope_chain;
struct z_candidate
{
  tree_base *fn;
  void *pad[11];
  z_candidate *next;
  int viable;
  int flags;
};

__attribute__((noipa)) struct z_candidate *
splice_viable (struct z_candidate *cands, bool strict_p, bool *any_viable_p)
{
  struct z_candidate *viable;
  struct z_candidate **last_viable;
  struct z_candidate **cand;
  bool found_strictly_viable = false;
  if (scope_chain->x_processing_template_decl)
    strict_p = true;
  viable = (z_candidate *) 0;
  last_viable = &viable;
  *any_viable_p = false;
  cand = &cands;
  while (*cand)
    {
      struct z_candidate *c = *cand;
      if (!strict_p && (c->viable == 1 || ((int) (c->fn)->code) == 273))
        {
          strict_p = true;
          if (viable && !found_strictly_viable)
            {
              *any_viable_p = false;
              *last_viable = cands;
              cands = viable;
              viable = (z_candidate *) 0;
              last_viable = &viable;
            }
        }
      if (strict_p ? c->viable == 1 : c->viable)
        {
          *last_viable = c;
          *cand = c->next;
          c->next = (z_candidate *) 0;
          last_viable = &c->next;
          *any_viable_p = true;
          if (c->viable == 1)
            found_strictly_viable = true;
        }
      else
        cand = &c->next;
    }
  return viable ? viable : cands;
}
With this and
./cc1plus -quiet -fpreprocessed -O2 -fprofile-generate -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -fno-common -fno-PIE -mcpu=power8
pr111601.ii -o pr111601.s3 -ffold-mem-offsets -da
vs.
./cc1plus -quiet -fpreprocessed -O2 -fprofile-generate -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -fno-common -fno-PIE -mcpu=power8
pr111601.ii -o pr111601.s4 -fno-fold-mem-offsets -da
the assembly difference is just
 .L13:
        std 9,0(10)
        mr 10,9
        li 5,0
+       addi 10,10,96
        li 7,1
        addi 4,4,1
        addi 6,6,1
        ld 9,96(9)
        std 9,0(8)
-       std 5,96(10)
+       std 5,0(10)
        stb 7,0(31)
        ori 2,2,0
        ld 9,0(8)
        cmpdi 0,9,0
        beq 0,.L18
        lwz 7,104(9)
        li 12,1
        li 5,1
        cmpwi 0,7,1
        beq 0,.L13
which shows the problem in a single loop.  Without the pass, %r10 is set to %r9
+ 96 and 5 (NULL) is stored to it first and if the loop loops again, 9 is
stored to it.  While with the pass, %r10 is set to %r9, 5 (NULL) is stored to
%r10 + 96 and then next iteration overwrites the fn pointer in the structure
rather than next.

  parent reply	other threads:[~2023-11-27 18:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 15:27 [Bug bootstrap/111601] New: [14 Regression] bootstrap " doko at gcc dot gnu.org
2023-09-26 17:15 ` [Bug bootstrap/111601] " pinskia at gcc dot gnu.org
2023-10-17  2:11 ` bergner at gcc dot gnu.org
2023-10-18 13:31 ` doko at gcc dot gnu.org
2023-10-18 19:48 ` bergner at gcc dot gnu.org
2023-10-18 20:41 ` bergner at gcc dot gnu.org
2023-10-18 20:53 ` pinskia at gcc dot gnu.org
2023-10-18 21:26 ` bergner at gcc dot gnu.org
2023-10-19  6:23 ` rguenth at gcc dot gnu.org
2023-11-17  5:33 ` jeevitha at gcc dot gnu.org
2023-11-24 19:59 ` jakub at gcc dot gnu.org
2023-11-26 21:36 ` [Bug bootstrap/111601] [14 Regression] profilebootstrap " jakub at gcc dot gnu.org
2023-11-27 11:37 ` jakub at gcc dot gnu.org
2023-11-27 12:24 ` rguenther at suse dot de
2023-11-27 12:27 ` jakub at gcc dot gnu.org
2023-11-27 13:31 ` jakub at gcc dot gnu.org
2023-11-27 13:51 ` jakub at gcc dot gnu.org
2023-11-27 15:14 ` jakub at gcc dot gnu.org
2023-11-27 16:21 ` jakub at gcc dot gnu.org
2023-11-27 16:45 ` jakub at gcc dot gnu.org
2023-11-27 16:57 ` jakub at gcc dot gnu.org
2023-11-27 17:01 ` jakub at gcc dot gnu.org
2023-11-27 18:33 ` jakub at gcc dot gnu.org [this message]
2023-11-27 19:24 ` jakub at gcc dot gnu.org
2023-11-27 20:02 ` jakub at gcc dot gnu.org
2023-11-27 20:17 ` jakub at gcc dot gnu.org
2023-11-29  8:18 ` cvs-commit at gcc dot gnu.org
2023-11-29  8:31 ` jakub at gcc dot gnu.org
2023-11-30 17:20 ` jeevitha 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-111601-4-Q25idew5XY@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).