From patchwork Wed Nov 7 15:41:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 994347 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-489259-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="U3NYZNw4"; 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 42qrHw5SGjz9sBh for ; Thu, 8 Nov 2018 02:41:47 +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=Re36GPpJjA9UZpg/0gk8r62TaTJp9Qq796Ut6D94RL2x+tOvsGQPH iie/ngBJcaQ2ktA0u+zOzL0uJ9fhsqGOaH5cEwpPtzkQ6u9JHzSDTIh2HF+89Xuc E1/4XmEg+HwQGB5Yrmiljz2sdOxyFK0NvhAaUZuTXWloVH6HdJww8w= 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=mwu4AKdbCNzi5nH+/63ktYHF17o=; b=U3NYZNw4ibaICqmnbTUB ckwDEL7pCLVYOHNk078UVaBnZxjcZ5OwXWYSCdUdqOmIGe5z/0nebEj81zn+sT1o o0hbvC1aasaveFvwmkUCpUa1+GqJK7s5CzBJAI8dtcmE3RHpN98Yfhg1NGmrnbjg ypclE7ogeRnzxyRCE8ehk6c= Received: (qmail 96685 invoked by alias); 7 Nov 2018 15:41:41 -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 96208 invoked by uid 89); 7 Nov 2018 15:41:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY autolearn=ham version=3.3.2 spammy=firefox 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 15:41:37 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7A13B2804FC; Wed, 7 Nov 2018 16:41:34 +0100 (CET) Date: Wed, 7 Nov 2018 16:41:34 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Simplify types of arrays Message-ID: <20181107154134.d2iufzncs3reflrd@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch simplfies types of arrays so we don't propagate duplicates when record/union contains array of pointers. With this we still miss simplification of pointers to arrays of structures (where we need to rebuild array same way as we rebuild pointers) and enumerate types. That should make simplification of types complete. Neither of those two seems very critical for GCC build, with the patch we are down to 24 duplicated types in bootstrap, I will collect data on firefox, but things looks quite good. (from tens of thousdant week ago). The patch works, but I am somewhat nervous because modyfing type inplace affects its type_hash_canon_hash and friends. There are pre-existing modifications to function parameters and things seems to just work, but I wonder if we have any strategy on keeping hashes in tree.c consitent across free-lang data? Or are all those hashes unused/freed at this time? lto-bootstrapped/regtested x86_64-linux. Honza * tree.c (free_lang_data_in_type): Simplify types of arrays. Index: tree.c =================================================================== --- tree.c (revision 265877) +++ tree.c (working copy) @@ -5320,6 +5320,8 @@ free_lang_data_in_type (tree type, struc TREE_PURPOSE (p) = NULL; } } + else if (TREE_CODE (type) == ARRAY_TYPE) + TREE_TYPE (type) = fld_simplified_type (TREE_TYPE (type), fld); else if (RECORD_OR_UNION_TYPE_P (type)) { /* Remove members that are not FIELD_DECLs from the field list