public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/105193] New: Code divergence based on -fdump-tree-* since r9-5080-gf7293b9dfab5e6e7
Date: Thu, 07 Apr 2022 09:43:17 +0000	[thread overview]
Message-ID: <bug-105193-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105193
           Summary: Code divergence based on -fdump-tree-* since
                    r9-5080-gf7293b9dfab5e6e7
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

The following code diverges:

$ cat NodeImpl.ii
struct NodeImpl {
  virtual bool isAttrImpl();
  void deleteIf();
  virtual int getOwnerDocument();
  void unreferenced();
  bool isOwned();
};
struct AttrImpl : NodeImpl {
  bool isAttrImpl();
};
bool NodeImpl::isAttrImpl() { return false; }
NodeImpl *deleteIf_thisNode;
void NodeImpl::deleteIf() {
  if (isOwned())
    return;
  isAttrImpl();
  ((AttrImpl *)deleteIf_thisNode)->getOwnerDocument();
}
void NodeImpl::unreferenced() { deleteIf(); }

$ g++ -O2 NodeImpl.ii -c -S -o 1.s -fdump-tree-all=/dev/null && g++ -O2
NodeImpl.ii -c -S -o 2.s && diff -u [12].s
--- 1.s 2022-04-07 11:43:05.995744783 +0200
+++ 2.s 2022-04-07 11:43:06.023744659 +0200
@@ -27,8 +27,10 @@
        testb   %al, %al
        jne     .L3
        movq    0(%rbp), %rax
-       movq    %rbp, %rdi
-       call    *(%rax)
+       movq    (%rax), %rax
+       cmpq    $_ZN8NodeImpl10isAttrImplEv, %rax
+       jne     .L10
+.L5:
        movq    deleteIf_thisNode(%rip), %rdi
        popq    %rbp
        .cfi_remember_state
@@ -41,8 +43,16 @@
 .L3:
        .cfi_restore_state
        popq    %rbp
+       .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
+       .p2align 4,,10
+       .p2align 3
+.L10:
+       .cfi_restore_state
+       movq    %rbp, %rdi
+       call    *%rax
+       jmp     .L5
        .cfi_endproc
 .LFE1:
        .size   _ZN8NodeImpl8deleteIfEv, .-_ZN8NodeImpl8deleteIfEv

             reply	other threads:[~2022-04-07  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  9:43 marxin at gcc dot gnu.org [this message]
2022-04-07  9:44 ` [Bug ipa/105193] " marxin 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-105193-4@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).