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/113359] [13 Regression] LTO miscompilation of ceph on aarch64
Date: Mon, 05 Feb 2024 21:48:48 +0000	[thread overview]
Message-ID: <bug-113359-4-Jgs0onl090@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113359-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> ---
SRA creates the replacements (in GCC 13) during total scalarization,
i.e. the bit that is not driven by pre-existing accesses to
aggregates, but because it sees an aggregate that is small and regular
and so it is split according to its type in the hope it will go away.

Unfortunately in the LTO and non-LTO case, they see a different type.
I have added a dumping of types and fields of totally scalarized
records and got the following.

In the non-LTO case, the type of the aggregate is:
  <record_type 0xffff553cabd0 pair readonly sizes-gimplified cxx-odr-p type_1
type_5 type_6 TI
    size <integer_cst 0xffff6fe96090 type <integer_type 0xffff6fe9c0a8
bitsizetype> constant 128>
    unit-size <integer_cst 0xffff6fe960a8 type <integer_type 0xffff6fe9c000
sizetype> constant 16>
    align:64 warn_if_not_align:0 symtab:1430035184 alias-set -1 canonical-type
0xffff553cabd0
    ...

and specifically its third field is a pointer:
  <field_decl 0xffff55161ab0 second
    type <pointer_type 0xffff4cf303f0
        type <record_type 0xffff4cf30348 Context cxx-odr-p type_1 type_4 type_5
type_6 VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xffff562720a8 context <translation_unit_decl 0xffff6fe9a000
/home/jakub/rpmbuild/BUILD/ceph-18.2.1/src/common/Timer.cc>
            pointer_to_this <pointer_type 0xffff4cf303f0>>
        unsigned DI
        size <integer_cst 0xffff6fe96048 constant 64>
        unit-size <integer_cst 0xffff6fe96060 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xffff562729d8 reference_to_this <reference_type 0xffff4cf6c738>>
    used unsigned nonlocal decl_3 DI /usr/include/c++/13/bits/stl_pair.h:194:11
    size <integer_cst 0xffff6fe96048 type <integer_type 0xffff6fe9c0a8
bitsizetype> constant 64>
    unit-size <integer_cst 0xffff6fe96060 type <integer_type 0xffff6fe9c000
sizetype> constant 8>
    align:64 warn_if_not_align:0 offset_align 128 decl_not_flexarray: 0
    offset <integer_cst 0xffff6fe96078 type <integer_type 0xffff6fe9c000
sizetype> constant 0>
    bit-offset <integer_cst 0xffff6fe96048 type <integer_type 0xffff6fe9c0a8
bitsizetype> constant 64> context <record_type 0xffff553ba540 pair>>


However, in the LTO case the type of the aggregate is:
  <record_type 0xffff61cc1498 pair cxx-odr-p TI
    size <integer_cst 0xffff623fdd08 type <integer_type 0xffff624100a8
bitsizetype> constant 128>
    unit-size <integer_cst 0xffff623fdd20 type <integer_type 0xffff62410000
sizetype> constant 16>
    align:64 warn_if_not_align:0 symtab:0 alias-set 98 canonical-type
0xffff61cc1498
    ...

which however has an unsigned int as its third field:
 <field_decl 0xffff61cc05f0 second
    type <integer_type 0xffff62410690 unsigned int public unsigned SI
        size <integer_cst 0xffff623fdf00 constant 32>
        unit-size <integer_cst 0xffff623fdf18 constant 4>
        align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xffff62410690 precision:32 min <integer_cst 0xffff623fdf30 0> max <integer_cst
0xffff623fdee8 4294967295>
        pointer_to_this <pointer_type 0xffff61cf50a8> reference_to_this
<reference_type 0xffff618fd5e8>>
    unsigned nonlocal SI /usr/include/c++/13/bits/stl_pair.h:194:11
    size <integer_cst 0xffff623fdf00 type <integer_type 0xffff624100a8
bitsizetype> constant 32>
    unit-size <integer_cst 0xffff623fdf18 type <integer_type 0xffff62410000
sizetype> constant 4>
    align:32 warn_if_not_align:0 offset_align 128 decl_not_flexarray: 0
    offset <integer_cst 0xffff623fdcf0 type <integer_type 0xffff62410000
sizetype> constant 0>
    bit-offset <integer_cst 0xffff623fdcc0 type <integer_type 0xffff624100a8
bitsizetype> constant 64> context <record_type 0xffff61cc1498 pair>>

An so only an unsigned int replacement is created.

The name of the aggregate indicates it has been created by IPA-SRA and
so that is where I am looking right now, but IPA-SRA simply takes (and
streams) the type of the access in the original function body for
these.  Can't this perhaps be some type-merging issue?

  parent reply	other threads:[~2024-02-05 21:48 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 18:31 [Bug tree-optimization/113359] New: " jakub at gcc dot gnu.org
2024-01-12 18:31 ` [Bug tree-optimization/113359] " jakub at gcc dot gnu.org
2024-01-12 18:32 ` jakub at gcc dot gnu.org
2024-01-12 18:32 ` jakub at gcc dot gnu.org
2024-01-12 18:33 ` jakub at gcc dot gnu.org
2024-01-12 18:34 ` [Bug ipa/113359] " jakub at gcc dot gnu.org
2024-01-12 19:54 ` jakub at gcc dot gnu.org
2024-01-12 19:56 ` jakub at gcc dot gnu.org
2024-01-12 20:29 ` pinskia at gcc dot gnu.org
2024-01-15  8:24 ` rguenth at gcc dot gnu.org
2024-02-05 21:48 ` jamborm at gcc dot gnu.org [this message]
2024-02-06  8:29 ` rguenth at gcc dot gnu.org
2024-02-06 10:00 ` hubicka at gcc dot gnu.org
2024-02-06 12:39 ` jakub at gcc dot gnu.org
2024-02-06 12:47 ` rguenther at suse dot de
2024-02-07 17:01 ` jamborm at gcc dot gnu.org
2024-02-19 15:31 ` jamborm at gcc dot gnu.org
2024-03-09 21:44 ` pinskia at gcc dot gnu.org
2024-03-09 21:45 ` sjames at gcc dot gnu.org
2024-03-09 21:45 ` [Bug ipa/113359] [13/14 " pinskia at gcc dot gnu.org
2024-03-15 15:02 ` law at gcc dot gnu.org
2024-03-15 15:13 ` avieira at gcc dot gnu.org
2024-03-15 15:25 ` law at gcc dot gnu.org
2024-03-26 10:42 ` [Bug ipa/113359] [13/14 Regression] LTO miscompilation of ceph on aarch64 and x86_64 rguenth at gcc dot gnu.org
2024-03-28  8:59 ` jamborm at gcc dot gnu.org
2024-04-04 11:40 ` hubicka at gcc dot gnu.org
2024-04-04 21:22 ` jamborm at gcc dot gnu.org
2024-04-08 16:57 ` cvs-commit at gcc dot gnu.org
2024-04-08 16:59 ` jamborm at gcc dot gnu.org
2024-04-08 17:01 ` [Bug ipa/113359] [13 " jakub at gcc dot gnu.org
2024-04-09  6:33 ` rguenth at gcc dot gnu.org
2024-05-14 11:22 ` cvs-commit at gcc dot gnu.org
2024-05-14 11:58 ` jamborm at gcc dot gnu.org
2024-05-14 12:00 ` jamborm at gcc dot gnu.org
2024-05-17 14:29 ` dkm at gcc dot gnu.org
2024-05-20 15:10 ` jamborm at gcc dot gnu.org
2024-05-20 15:13 ` dkm 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-113359-4-Jgs0onl090@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).