From patchwork Fri Oct 13 13:24:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1848275 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J3KlThq3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S6S0Z0sM3z1yqj for ; Sat, 14 Oct 2023 00:24:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC5A5385770D for ; Fri, 13 Oct 2023 13:24:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DAD203858D1E for ; Fri, 13 Oct 2023 13:24:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DAD203858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697203470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=o0VG0KGguYJ7PsVMwJbupryhComqFJ1gg/cEU+EuIJ8=; b=J3KlThq3gGmAwiyfyc7r9HVQneO3HnesONdDnl7SWpq1ybznqULOUQVmn4PYkwOS4YSip6 sYyeLZ2PW80NW9CCa4SQZh2hs5zeswxO6GmM2BBYfGkoDWoMH6kUNwP2wXQqXNpVw53aE7 m1NQXPKrPSdQbd+4CyWY8e7/zgfKMF8= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-443-JRHdPpJ9PtKw_K0IoJlOxQ-1; Fri, 13 Oct 2023 09:24:27 -0400 X-MC-Unique: JRHdPpJ9PtKw_K0IoJlOxQ-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7740bc7ad68so253417185a.2 for ; Fri, 13 Oct 2023 06:24:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697203466; x=1697808266; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W6Sr4IVwn0ZzFdCXAZwLoAt4qZQrWd55VUV2vmuoCww=; b=AJr95Vef5DYWWVwW+5PbcmnBltRJg09ZKRDM+40FZ9mSROiKyGVmhxMmQAM64iiA1I jjHvPVw6dl6BrYkwm6oAqZxPPzoW8wjTPsSmD+MAqqOl+k/v6clhuamq/H1hu16XJVLH fjgJ6DRJPprQGfkLMxxX+bb2lk0wVYIgN5VPIDNdW+SF7WSPD/pqnY2sT7PYm/mp0JMl 3stMqDYly1V4bxGPeoOWuAsg1naF5KOLYiGg6ycnSSEVvA9ElDK0apXJDTqF8yIjpeeF 18EwatHMN5wHMEKPcpcEbGwILq/dvrNxhYLMqs+pL1zwQD/rTu+qiKtAr0QW3m5KXy3v tWYQ== X-Gm-Message-State: AOJu0YyUUm9cmhVeuwgmfmQAKmSp3kPx8i8zsVdOVyOmAWi+W7HQzs1X eHvjLw9fJNOamK0SjqMfI+Lh09TiakPFgEEaj9/WpvAPKUPW6J8m+beXYgjFdG6Wq8z6kcyKYzn OBVGBhJ1ttRZLoAQ2bzt4H2T1DyM0IjF4krdBu/PYWmP3b4og0OyIxdfWdK4yckAzLfB3KBTc4v vxNg== X-Received: by 2002:a05:620a:2454:b0:76f:1ead:e4fd with SMTP id h20-20020a05620a245400b0076f1eade4fdmr32391152qkn.40.1697203466709; Fri, 13 Oct 2023 06:24:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZsc9uS5Jom2cQGpImVwmKeH67cQJIBEXfUl/oroYSfgO62wW9podxG6QTMAwfjdCUBgm+1A== X-Received: by 2002:a05:620a:2454:b0:76f:1ead:e4fd with SMTP id h20-20020a05620a245400b0076f1eade4fdmr32391135qkn.40.1697203466352; Fri, 13 Oct 2023 06:24:26 -0700 (PDT) Received: from ?IPV6:2607:fea8:51e1:2000::77e1? ([2607:fea8:51e1:2000::77e1]) by smtp.gmail.com with ESMTPSA id pi31-20020a05620a379f00b00763b94432ebsm626082qkn.18.2023.10.13.06.24.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Oct 2023 06:24:25 -0700 (PDT) Message-ID: <72519953-7b2c-5156-485d-75904da5a90a@redhat.com> Date: Fri, 13 Oct 2023 09:24:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: gcc-patches From: Andrew MacLeod Subject: [COMMITTED] [GCC13] PR tree-optimization/111622 - Do not add partial equivalences with no uses. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org There are a lot of dead statements in this testcase which a casts. These were being added to the list of partial equivalences and causing some serious compile time issues. Rangers cache loops through equivalences when its propagating on-entry values, so if the partial equivalence list is very large, it can consume a lot of time.  Typically, partial equivalence lists are small.   In this case, a lot of dead stmts were not removed, so there was no redundancy elimination and it was causing an issue. Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. Andrew From 425964b77ab5b9631e914965a7397303215c77a1 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 12 Oct 2023 17:06:36 -0400 Subject: [PATCH] Do not add partial equivalences with no uses. PR tree-optimization/111622 * value-relation.cc (equiv_oracle::add_partial_equiv): Do not register a partial equivalence if an operand has no uses. --- gcc/value-relation.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index fc792a4d5bc..0ed5f93d184 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -389,6 +389,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) // In either case, if PE2 has an entry, we simply do nothing. if (pe2.members) return; + // If there are no uses of op2, do not register. + if (has_zero_uses (op2)) + return; // PE1 is the LHS and already has members, so everything in the set // should be a slice of PE2 rather than PE1. pe2.code = pe_min (r, pe1.code); @@ -406,6 +409,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) } if (pe2.members) { + // If there are no uses of op1, do not register. + if (has_zero_uses (op1)) + return; pe1.ssa_base = pe2.ssa_base; // If pe2 is a 16 bit value, but only an 8 bit copy, we can't be any // more than an 8 bit equivalence here, so choose MIN value. @@ -415,6 +421,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) } else { + // If there are no uses of either operand, do not register. + if (has_zero_uses (op1) || has_zero_uses (op2)) + return; // Neither name has an entry, simply create op1 as slice of op2. pe2.code = bits_to_pe (TYPE_PRECISION (TREE_TYPE (op2))); if (pe2.code == VREL_VARYING) -- 2.41.0