From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32003 invoked by alias); 17 Dec 2014 19:08:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31904 invoked by uid 55); 17 Dec 2014 19:08:04 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/64330] [5 Regression] IPA-ICF merges const exported vars that could be addressable in other TUs Date: Wed, 17 Dec 2014 19:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg02029.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64330 --- Comment #9 from Jan Hubicka --- > Thank you for the missing externally visible attribute. > > I've been testing following patch: > > diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c > index b193200..0685019 100644 > --- a/gcc/ipa-icf.c > +++ b/gcc/ipa-icf.c > @@ -1131,8 +1131,12 @@ sem_variable::parse (varpool_node *node, bitmap_obstack > *stack) > tree decl = node->decl; > > bool readonly = TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl); > - bool can_handle = readonly && (DECL_VIRTUAL_P (decl) > - || !TREE_ADDRESSABLE (decl)); > + if (!readonly) > + return NULL; > + > + bool can_handle = DECL_VIRTUAL_P (decl) > + || flag_merge_constants >= 2 > + || (!TREE_ADDRESSABLE (decl) && !node->externally_visible); > > if (!can_handle) > return NULL; > > As soon as tests finish, I will send it to ML. Thanks, the patch is OK if it passes. Also please be sure that we won't merge DECL_EXTERNAL at all. Producing an extenral alias is not going to save any code. Honza > > Martin > > -- > You are receiving this mail because: > You are on the CC list for the bug.