public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mittorn at sibmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/103386] New: stage1 with PGO produces bad offsets in rtl-reload on aarch64
Date: Tue, 23 Nov 2021 15:06:37 +0000	[thread overview]
Message-ID: <bug-103386-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 103386
           Summary: stage1 with PGO produces bad offsets in rtl-reload on
                    aarch64
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mittorn at sibmail dot com
  Target Milestone: ---

Created attachment 51862
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51862&action=edit
pgo build logs and system environment

This result in failed conftest binary returning nonzero status when trying to
build libgomp.
Simple program to reproduce conftest behaviour:

int main()
{
return 0;
}

stage1 makes bad assembly on it:

        .cfi_startproc
        stp     x0, x1, [sp, -32]!
        .cfi_def_cfa_offset 32
        .cfi_offset 0, -32
        .cfi_offset 1, -24
        stp     x2, x3, [sp, 16]
        .cfi_offset 2, -16
        .cfi_offset 3, -8
        mov     w0, 0
        ldp     x2, x3, [sp, 16]
        ldp     x0, x1, [sp], 32
        .cfi_restore 1
        .cfi_restore 0
        .cfi_restore 2
        .cfi_restore 3
        .cfi_def_cfa_offset 0
        ret
        .cfi_endproc

instead of this one:
        .cfi_startproc
        mov     w0, 0
        ret
        .cfi_endproc


after dumping RTL stages, i found this (source files are identical, second is
stage1):

 ~ # diff 1.c.292r.reload 2.c.292r.reload
7a8,12
> New elimination table:
> Can eliminate 65 to 31 (offset=32, prev_offset=0)
> Can eliminate 65 to 29 (offset=32, prev_offset=0)
> Can eliminate 64 to 31 (offset=32, prev_offset=0)
> Can eliminate 64 to 29 (offset=32, prev_offset=0)
51,54c56,59
< Can eliminate 65 to 31 (offset=0, prev_offset=0)
< Can eliminate 65 to 29 (offset=0, prev_offset=0)
< Can eliminate 64 to 31 (offset=0, prev_offset=0)
< Can eliminate 64 to 29 (offset=0, prev_offset=0)
---
> Can eliminate 65 to 31 (offset=32, prev_offset=32)
> Can eliminate 65 to 29 (offset=32, prev_offset=0)
> Can eliminate 64 to 31 (offset=32, prev_offset=32)
> Can eliminate 64 to 29 (offset=32, prev_offset=0)
81c86
<         (const_int 0 [0])) "1.c":3:8 52 {*movsi_aarch64}
---
>         (const_int 0 [0])) "2.c":3:8 52 {*movsi_aarch64}
83c88
< (insn 13 5 15 2 (use (reg/i:SI 0 x0)) "1.c":4:1 -1
---
> (insn 13 5 15 2 (use (reg/i:SI 0 x0)) "2.c":4:1 -1


Full build tree temporary placed here:
http://mittorn.mentality.rip/
needed log and environment info in attachment

             reply	other threads:[~2021-11-23 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 15:06 mittorn at sibmail dot com [this message]
2021-11-23 18:30 ` [Bug middle-end/103386] " pinskia at gcc dot gnu.org
2021-11-24 16:57 ` mittorn at sibmail dot com
2021-11-25  1:02 ` [Bug middle-end/103386] -floop-nest-optimize -floop-interchange -fgraphite-identity miscompiles gcc pinskia 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-103386-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).