From patchwork Wed Nov 7 14:17:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 994278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-489243-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JkXCrhQE"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qpQn4hsTz9sCw for ; Thu, 8 Nov 2018 01:17:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=jjTNa5mihy97y+1N7P2jS7NgLTxL1nt3LR2ftVJLbd5ejPO0DcbZb mB97b3qHbaDFMvjKiCCFnXa+uK4N7VGrZ3OTlo/3PvW4h61n6kcMCCkv8JdkMHLs Sgiak1UZ1cAyYespSsP0lce5qxrN5KGwinIJEpivGD1LjBuA8RfgyU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=nGZAXVs0BRj459O9JDtQZcR+y4Y=; b=JkXCrhQE3pkarbShq33b WrknuTkqhlyJoD+VjfcFLFNjXdL2na7DPFJPi7jNeCQTPLb0cBy5A+SLPU63dhSg JyPyzFduAhxw+b1X+vWDyVYYflFGWBVqr3gQZEF+Sf6dg4LqK4Rrg7H1ngKWPSyC zmdAPem/V1yW5uaEZF9EpT4= Received: (qmail 63117 invoked by alias); 7 Nov 2018 14:17:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 63108 invoked by uid 89); 7 Nov 2018 14:17:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=TREE_READONLY, sk:TYPE_TY, tree_readonly, sk:type_ty X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Nov 2018 14:17:26 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 242262804FC; Wed, 7 Nov 2018 15:17:24 +0100 (CET) Date: Wed, 7 Nov 2018 15:17:24 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Clear more useless flags Message-ID: <20181107141724.w6azzxooz7hxkr2t@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch enables bit more merging by clearing more flags that are unnecesary and differ in practice across different copies of same ODR types. lto-bootstrapped/regtested x86_64-linux, OK? * tree.c (fld_incomplete_type_of): Clear TREE_ADDRESSABLE flag. (free_lang_data_in_decl): Set TREE_ADDRESSABLE for public functions and variables; clear DECL_EXTERNAL, TYPE_DECL_SUPPRESS_DEBUG and DECL_MODE on TYPE_DECLs. Index: tree.c =================================================================== --- tree.c (revision 265875) +++ tree.c (working copy) @@ -5197,6 +5197,7 @@ fld_incomplete_type_of (tree t, struct f TYPE_SIZE_UNIT (copy) = NULL; TYPE_CANONICAL (copy) = TYPE_CANONICAL (t); TYPE_TYPELESS_STORAGE (copy) = 0; + TREE_ADDRESSABLE (copy) = 0; if (AGGREGATE_TYPE_P (t)) { TYPE_FIELDS (copy) = NULL; @@ -5496,6 +5497,17 @@ free_lang_data_in_decl (tree decl, struc if (TREE_CODE (decl) == FUNCTION_DECL) { struct cgraph_node *node; + /* Frontends do not set TREE_ADDRESSABLE on public variables even though + the address may be taken in other unit, so this flag has no practical + use for middle-end. + + It would make more sense if frontends set TREE_ADDRESSABLE to 0 only + for public objects that indeed can not be adressed, but it is not + the case. Set the flag to true so we do not get merge failures for + i.e. virtual tables between units that take address of it and + units that don't. */ + if (TREE_PUBLIC (decl)) + TREE_ADDRESSABLE (decl) = true; TREE_TYPE (decl) = fld_simplified_type (TREE_TYPE (decl), fld); if (!(node = cgraph_node::get (decl)) || (!node->definition && !node->clones)) @@ -5551,6 +5563,9 @@ free_lang_data_in_decl (tree decl, struc } else if (VAR_P (decl)) { + /* See comment above why we set the flag for functions. */ + if (TREE_PUBLIC (decl)) + TREE_ADDRESSABLE (decl) = true; if ((DECL_EXTERNAL (decl) && (!TREE_STATIC (decl) || !TREE_READONLY (decl))) || (decl_function_context (decl) && !TREE_STATIC (decl))) @@ -5560,8 +5575,12 @@ free_lang_data_in_decl (tree decl, struc { DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; DECL_VISIBILITY_SPECIFIED (decl) = 0; + /* TREE_PUBLIC is used to tell if type is anonymous. */ + DECL_EXTERNAL (decl) = 0; + TYPE_DECL_SUPPRESS_DEBUG (decl) = 0; DECL_INITIAL (decl) = NULL_TREE; DECL_ORIGINAL_TYPE (decl) = NULL_TREE; + DECL_MODE (decl) = VOIDmode; TREE_TYPE (decl) = void_type_node; SET_DECL_ALIGN (decl, 0); }