From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 262AB385840D for ; Sat, 19 Nov 2022 02:53:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 262AB385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62b.google.com with SMTP id k7so6120093pll.6 for ; Fri, 18 Nov 2022 18:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=20E+ljKdUA6N50jWyXs/tMrf8BOH67Pcz7GGz0zRFEE=; b=HXD37qLnHC1Fen7fbdVDcSoTEpx1Fp9moO8OSwaeOcFx3OHuD0L5QUVl4AWMG6XLit DCvv896ueuxqq+zU1swv5fqooEW5p9NC47dwdWmqEuk9U1+e40szFKS/OANT3mXBl1LA 2heX4o5FQKNSSX0r7cOvLjeZhD5aXemMHpdGiyFzCnHeKTqf7LZy8ECIvDF1F4QNcoYT dwLOJElipNZ3Y84n+JhaMCpIWHXO16l+05AwQs5k39jccv7cjtmBj7H09fEDldKAa2RQ NeiPBjhYtyJyB57KPxrg/7w9eUZbLCRol2XLykKh4YR+cIx9XD4p2MBGfQSxLTnGbNux suCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=20E+ljKdUA6N50jWyXs/tMrf8BOH67Pcz7GGz0zRFEE=; b=HzfInpOBMtreZY8j86KrZ05vhc0288z66ykxwUR7Z5/MQyF551Af+6UVNilU5EiCgj Zee4nwkqWE7aRVXWUdu2v2n6um+JRLPu9S6x9StBBhpfbIQek74brr4M2v/YieRvdM90 BzHlvRQV66N3fZiZONKCQgsKgRSQ6UzcZhHC7zWBuNdHNUnoKsoXqhOLTt+HFI9hZXrD 94qaznMmLcZ6uJJ6TjE0jLjLd7ZmZgBchelzD0xblCDcFIpFijtWJaFPlVbxm+ZStsPA PmdzHfswi9n9Q7qaj4fEc4MPWvMMKN0f+p2ilhWJLDoSj0w1mwXMDDL1iG3eUhcwFkRY JM+A== X-Gm-Message-State: ANoB5pkegtv5raBEwI4pk+jw4olTqmhiHUx46v1PPm61hOT5lHp/X3uT hobNMAidT8KXV6IQvRQiqALKj29FbTpFkaQ4jUM= X-Google-Smtp-Source: AA0mqf5fsWHpqboqRuPQ07i5ZsrgtLFhT5hcrWJWoy2S3vjOohfL0pgI5xRUddUrPwl02pAMPH0t0+wn0Z8AEepQfIE= X-Received: by 2002:a17:902:f643:b0:187:3c62:5837 with SMTP id m3-20020a170902f64300b001873c625837mr2205689plg.123.1668826404773; Fri, 18 Nov 2022 18:53:24 -0800 (PST) MIME-Version: 1.0 References: <1668794731-9349-1-git-send-email-apinski@marvell.com> <337e91f6-e8ad-3a45-cb94-9093cd33c6e9@gmail.com> In-Reply-To: <337e91f6-e8ad-3a45-cb94-9093cd33c6e9@gmail.com> From: Andrew Pinski Date: Fri, 18 Nov 2022 18:53:12 -0800 Message-ID: Subject: Re: [PATCH] constexprify some tree variables To: Jeff Law Cc: apinski@marvell.com, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Nov 18, 2022 at 12:06 PM Jeff Law via Gcc-patches wrote: > > > On 11/18/22 11:05, apinski--- via Gcc-patches wrote: > > From: Andrew Pinski > > > > Since we use C++11 by default now, we can > > use constexpr for some const decls in tree-core.h. > > > > This patch does that and it allows for better optimizations > > of GCC code with checking enabled and without LTO. > > > > For an example generic-match.cc compiling is speed up due > > to the less number of basic blocks and less debugging info > > produced. I did not check the speed of compiling the same source > > but rather the speed of compiling the old vs new sources here > > (but with the same compiler base). > > > > The small slow down in the parsing of the arrays in each TU > > is migrated by a speed up in how much code/debugging info > > is produced in the end. > > > > Note I looked at generic-match.cc since it is one of the > > compiling sources which causes parallel building to stall and > > I wanted to speed it up. > > > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > Or should this wait until GCC 13 branches off? > > > > gcc/ChangeLog: > > > > PR middle-end/14840 > > * tree-core.h (tree_code_type): Constexprify > > by including all-tree.def. > > (tree_code_length): Likewise. > > * tree.cc (tree_code_type): Remove. > > (tree_code_length): Remove. > > I would have preferred this a week ago :-) And if it was just > const-ifying, I'd ACK it without hesitation. Yes I know which is why I am ok with waiting for GCC 14 really. I decided to try to clear out some of the old bug reports assigned to myself and this one was one of the oldest and also one of the easiest to do. > > Can you share any of the build-time speedups you're seeing, even if > they're not perfect. It'd help to get a sense of the potential gain > here and whether or not there's enough gain to gate it into gcc-13 or > have it wait for gcc-14. > > > And if we can improve the compile-time of the files generated by > match.pd, that's a win. It's definitely a serialization point -- it > becomes *painfully* obvious when doing a bootstrap using qemu, when that > file takes 1-2hrs after everything else has finished. I recorded some of the timings in the bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14840#c14 Summary is using the same compiler as a base, compiling generic-match.cc is now ~7% faster. I have not looked into why but I can only assume it is due to less debug info and less basic blocks. I assume without checking enabled (or rather release checking) on the sources, I can only assume the speedup is not going to be seen. Most of the constant reads are in the checking part of the code. Thanks, Andrew Pinski > > > Jeff