From patchwork Mon Aug 26 15:44:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 269914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 386032C007B for ; Tue, 27 Aug 2013 01:44:58 +1000 (EST) 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=lqEnCOqQEWt2tM7xYsU1d9XrL2p4vrQtEfnJlqHv3HkSTAPQoCa9z Ymdp40sVu5XOXmOZnzQJI2iN1qoR3fq7a2jVx6YUbuZOd66KDRNAR+ElofdQ0dYl J+Xp+T6rcimKdVT/yojk0FWNkI+Nb3K4xwH96Sez5VZDTxWRLHiGi0= 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=75goCmkMUFzmqAn3e6ZGjJxPD14=; b=j6GTbTjE92RqkdMW+SZu iFBW7FV8+sKQ1stpUU9EUpjULBZGyHCmjHRw0D+Fc5LE2wQMK5XWmjNAgCkOjnWl V7Dwv9VRpQROSI3zvhT0FUO3qDd/9vHAGBIA7snLgFAr/9zAK1+Bih7u/I8bg/A6 OFX+l5n9YuNWIQBdt7Eaj8o= Received: (qmail 16315 invoked by alias); 26 Aug 2013 15:44:51 -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 16306 invoked by uid 89); 26 Aug 2013 15:44:51 -0000 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 (AES256-SHA encrypted) ESMTPS; Mon, 26 Aug 2013 15:44:51 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A5A84541785; Mon, 26 Aug 2013 17:44:47 +0200 (CEST) Date: Mon, 26 Aug 2013 17:44:47 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: C++ constructors/destructors can not have address taken. Message-ID: <20130826154447.GA6539@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, this patch tesch comdat_can_be_unshared_p_1 about the fact that C++ constructors and destructors can not have address taken that can be used for equivalence comparsion. This mean that we can privatize them into the DSO. Bootstrapped/regtested x86_64-linux, comitted. * ipa.c (comdat_can_be_unshared_p_1): C++ constructors and destructors can be unshared. Index: ipa.c =================================================================== --- ipa.c (revision 201995) +++ ipa.c (working copy) @@ -574,9 +574,13 @@ static bool comdat_can_be_unshared_p_1 (symtab_node node) { /* When address is taken, we don't know if equality comparison won't - break eventually. Exception are virutal functions and vtables, - where this is not possible by language standard. */ + break eventually. Exception are virutal functions, C++ + constructors/destructors and vtables, where this is not possible by + language standard. */ if (!DECL_VIRTUAL_P (node->symbol.decl) + && (TREE_CODE (node->symbol.decl) != FUNCTION_DECL + || (!DECL_CXX_CONSTRUCTOR_P (node->symbol.decl) + && !DECL_CXX_DESTRUCTOR_P (node->symbol.decl))) && address_taken_from_non_vtable_p (node)) return false;