public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/114480] g++: internal compiler error: Segmentation fault signal terminated program cc1plus
Date: Thu, 04 Apr 2024 09:42:48 +0000	[thread overview]
Message-ID: <bug-114480-4-EyVvyvdBFC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114480-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
Alexander - the testcase at -O1 shows curiously high

   3.16%          9840  cc1plus  cc1plus             [.] mergesort<sort_ctx>

which is attributed (by callgrind) to

      if (sizeof (size_t) == 8 && LIKELY (c->size == 8))
-->     MERGE_ELTSIZE (8);

and the caller in tree-into-ssa.cc:prune_unused_phi_nodes doing

  qsort (defs, adef, sizeof (struct dom_dfsnum), cmp_dfsnum);

I'm not sure why callgrind pins it this way, but perf somewhat agrees:

Samples│    │MERGE_ELTSIZE (8);                                               
▒
     1 │2d0:│  mov    %r9,%rsi                                                
▒
     8 │    │  mov    %r9,0x8(%rsp)                                           
▒
   528 │    │  mov    %r12,%rdi                                               
▒
    31 │    │→ call   *0x0(%r13)                                              
▒
   236 │    │  mov    0x8(%rsp),%r9                                           
▒
     2 │    │  sar    $0x1f,%eax                                              
▒
   244 │    │  mov    %r12,%rcx                                               
▒
       │    │  movslq %eax,%rdx                                               
▒
   531 │    │  and    $0x8,%eax                                               
▒
    62 │    │  add    $0x8,%rbx                                               
▒
       │    │  cltq                                                           
◆
   725 │    │  xor    %r9,%rcx                                                
▒
   914 │    │  add    %rax,%r12                                               
▒
     1 │    │  and    %rdx,%rcx                                               
▒
       │    │  xor    %r9,%rcx                                                
▒
     3 │    │  mov    (%rcx),%rcx                                             
▒
  2155 │    │  mov    %rcx,-0x8(%rbx)                                         
▒
    29 │    │  cmp    %r12,%rbx                                               
▒
       │    └──je     1d7

I'll note the swapping of 8 bytes is a bit odd and it seems to be
if-converted, thus always doing a write.

I'm of course questioning what prune_unused_phi_nodes does but I have no
idea if that's sensible at all, but it seems slow for this testcase, and
the sorting is the slowest part of it.

  parent reply	other threads:[~2024-04-04  9:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 11:40 [Bug c++/114480] New: " douglas.boffey at gmail dot com
2024-03-26 11:42 ` [Bug c++/114480] " douglas.boffey at gmail dot com
2024-03-26 11:46 ` pinskia at gcc dot gnu.org
2024-03-26 11:46 ` pinskia at gcc dot gnu.org
2024-03-26 11:51 ` douglas.boffey at gmail dot com
2024-03-26 12:05 ` pinskia at gcc dot gnu.org
2024-03-26 12:15 ` pinskia at gcc dot gnu.org
2024-03-26 12:26 ` pinskia at gcc dot gnu.org
2024-03-26 12:26 ` pinskia at gcc dot gnu.org
2024-03-26 12:31 ` douglas.boffey at gmail dot com
2024-03-26 12:41 ` redi at gcc dot gnu.org
2024-03-27  8:28 ` rguenth at gcc dot gnu.org
2024-03-27 19:49 ` vmakarov at gcc dot gnu.org
2024-03-28  8:17 ` cvs-commit at gcc dot gnu.org
2024-03-28  8:44 ` rguenth at gcc dot gnu.org
2024-03-28 10:12 ` rguenth at gcc dot gnu.org
2024-03-28 10:39 ` rguenth at gcc dot gnu.org
2024-04-02 13:28 ` rguenth at gcc dot gnu.org
2024-04-03  6:57 ` cvs-commit at gcc dot gnu.org
2024-04-03 11:47 ` rguenth at gcc dot gnu.org
2024-04-04  9:42 ` rguenth at gcc dot gnu.org [this message]
2024-04-04 18:41 ` amonakov at gcc dot gnu.org
2024-04-05 15:35 ` amonakov at gcc dot gnu.org
2024-04-08  9:46 ` rguenth at gcc dot gnu.org
2024-04-08  9:50 ` douglas.boffey at gmail dot com
2024-04-08  9:54 ` rguenther at suse dot de
2024-04-08 12:32 ` douglas.boffey at gmail dot com
2024-04-08 13:07 ` rguenther at suse dot de
2024-04-08 13:22 ` [Bug c++/114480] [12/13/14 Regression " rguenth at gcc dot gnu.org
2024-04-08 13:37 ` [Bug c++/114480] [12/13/14 Regression] " rguenth at gcc dot gnu.org
2024-04-09  7:51 ` rguenth at gcc dot gnu.org
2024-04-09 11:39 ` rguenth at gcc dot gnu.org
2024-05-14 13:41 ` [Bug c++/114480] [12/13/14/15 " rguenth at gcc dot gnu.org
2024-05-17 12:29 ` cvs-commit 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-114480-4-EyVvyvdBFC@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).