public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	gcc-patches@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>,
	Eric Botcazou <ebotcazou@adacore.com>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [PATCH v7] Introduce attribute sym_alias
Date: Thu, 07 Dec 2023 17:52:56 -0300	[thread overview]
Message-ID: <ory1e5buqf.fsf@lxoliva.fsfla.org> (raw)
In-Reply-To: <ZXBHu+UNv47bCihl@kam.mff.cuni.cz> (Jan Hubicka's message of "Wed, 6 Dec 2023 11:06:51 +0100")

On Dec  6, 2023, Jan Hubicka <hubicka@ucw.cz> wrote:

>> On Nov 30, 2023, Jan Hubicka <hubicka@ucw.cz> wrote:
>> 
>> >> +      if (VAR_P (replaced))
>> >> +	varpool_node::create_alias (sym_node->decl, replacement);
>> >> +      else
>> >> +	cgraph_node::create_alias (sym_node->decl, replacement);
>> 
>> Unfortunately, this change didn't work.  Several of the C++ tests
>> regressed with it.  Going back to same-body aliases, they work.
>> 
>> I suspect this may have to do with the infrastructure put in to deal
>> with cdtors clones.

> Do you have short testcase for this?

attr-sym-alias-[13].C are not too big, and show various regressions with
the incremental patchlet below (to be applied on top of v7], but here's
a minimal testcase that triggers the problem:

struct foo {
  __attribute__ ((__sym_alias__ ("FOODTR_A"))) ~foo() {}
};
foo bar;

> THe main oddities with same body
> aliases comes from the fact that C++ FE creates them early during
> parsing before all declaration flags are finished.

*nod*, this is probably why some of the cdtor and even sym_aliases for
inline member functions (FOOBAR_B and FOOBAR_C in attr-sym-alias-1.C,
and FOOCLS_INT_VIRT in attr-sym-alias-3.C) fail to be output when not
using create_same_body_alias.

diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index abfbbbf6294..65ce610f2d4 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -2717,8 +2717,8 @@ create_sym_alias_decl (tree decl, tree id)
     // node = varpool_node::create_extra_name_alias (clone, decl);
     node = varpool_node::create_alias (clone, decl);
   else
-    node = cgraph_node::create_same_body_alias (clone, decl);
-    // node = cgraph_node::create_alias (clone, decl);
+    // node = cgraph_node::create_same_body_alias (clone, decl);
+    node = cgraph_node::create_alias (clone, decl);
   if (symtab_node *dnode = symtab_node::get_create (decl))
     node->copy_visibility_from (dnode);
 
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index 44df52095c1..e40240077f2 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -1993,8 +1993,8 @@ symtab_node::remap_sym_alias_target (tree replaced, tree replacement)
 	// varpool_node::create_extra_name_alias (sym_node->decl, replacement);
 	varpool_node::create_alias (sym_node->decl, replacement);
       else
-	cgraph_node::create_same_body_alias (sym_node->decl, replacement);
-	// cgraph_node::create_alias (sym_node->decl, replacement);
+	// cgraph_node::create_same_body_alias (sym_node->decl, replacement);
+	cgraph_node::create_alias (sym_node->decl, replacement);
       sym_node->copy_visibility_from (repl_node);
     }
 }

> Fixup copies some flags such as inline flags, visibility and comdat
> groups which can change during parsing process.

*nod*, I've run into some of that, and had to add visibility propagation
to the sym_aliases to make up for it.

But I'm not sure that that's the issue you're getting at.  Some
sym_aliases don't even get output with this patchlet.  FOODTR_A* aliases
get created during parsing, when maybe_clone_body creates the dtor
clones and their cgraph nodes to set their comdat group.  ISTM that it's
the later visibility copying because of same body alias that enables the
alias declaration to get the same (final) visibility as the declarations
they alias.  Which suggests that there could be another way to ensure
the update takes place, but the best spot for it has so far eluded me.

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

      reply	other threads:[~2023-12-07 20:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 20:56 [RFC, WIP] introduce attribute exalias Alexandre Oliva
2020-08-07 17:38 ` [PATCH] " Alexandre Oliva
2020-08-14 15:39   ` Alexandre Oliva
2020-08-14 16:24     ` Nathan Sidwell
2020-08-14 19:24       ` Alexandre Oliva
2020-08-14 22:12         ` Nathan Sidwell
2020-08-15  2:43           ` Alexandre Oliva
2020-08-15  9:22             ` Iain Sandoe
2020-08-15 16:39               ` Alexandre Oliva
2020-08-15 18:17                 ` Iain Sandoe
2020-08-25  8:34                   ` Alexandre Oliva
2020-08-25 11:23                     ` Iain Sandoe
2020-08-15 17:26               ` Alexandre Oliva
2020-08-15 21:11             ` Nathan Sidwell
2020-08-25  7:50               ` Alexandre Oliva
2023-07-15  1:08   ` [PATCH v3] Introduce attribute reverse_alias Alexandre Oliva
2023-07-15 21:55     ` Nathan Sidwell
2023-07-18  4:29       ` Alexandre Oliva
2023-07-18 11:37         ` Richard Biener
2023-07-19 23:11           ` [PATCH v4] Introduce attribute sym Alexandre Oliva
2023-07-20 13:09             ` Richard Biener
2023-07-21  9:23               ` Alexandre Oliva
2023-07-22  3:12             ` Fangrui Song
2023-08-16  4:27               ` Alexandre Oliva
     [not found]             ` <orpm2tgrsd.fsf_-_@lxoliva.fsfla.org>
     [not found]               ` <CAH6eHdQ3vT3MjohuE-izto+K=BMRykY3T-UyWa5-=OTDPM-JsQ@mail.gmail.com>
     [not found]                 ` <ory1h9t6nr.fsf@lxoliva.fsfla.org>
2023-09-20  5:59                   ` [PATCH v5] Introduce attribute sym_alias (was: Last call for bikeshedding on attribute sym/exalias/reverse_alias) Alexandre Oliva
2023-11-20 12:54                     ` [PATCH v5] Introduce attribute sym_alias Alexandre Oliva
2023-11-22 12:14                       ` Richard Biener
2023-11-22 19:16                         ` Joseph Myers
2023-11-22 13:13                     ` [PATCH v5] Introduce attribute sym_alias (was: Last call for bikeshedding on attribute sym/exalias/reverse_alias) Jan Hubicka
2023-11-30 12:53                       ` [PATCH v6] Introduce attribute sym_alias Alexandre Oliva
2023-11-30 15:24                         ` Jan Hubicka
2023-12-01 11:25                           ` [PATCH v7] " Alexandre Oliva
2023-12-06  2:10                             ` [PATCH v8] " Alexandre Oliva
2023-12-06 10:06                             ` [PATCH v7] " Jan Hubicka
2023-12-07 20:52                               ` Alexandre Oliva [this message]

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=ory1e5buqf.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=joseph@codesourcery.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=nathan@acm.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).