From patchwork Thu Sep 1 13:04:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp242578wro; Thu, 1 Sep 2022 06:05:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR41L6JJxbNK9QX569z4C1lZAu9rblaza93rgYBdHyvOXyIxyuNXKE0t+zwwxX6PTfrsp4ol X-Received: by 2002:a17:906:9bf3:b0:741:6900:61a5 with SMTP id de51-20020a1709069bf300b00741690061a5mr14825610ejc.286.1662037549263; Thu, 01 Sep 2022 06:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662037549; cv=none; d=google.com; s=arc-20160816; b=ntqoQdDh0LAJldYYBxWltx8r8rOSWShNW3MA1VzH1iZfsAH2yqESwHkQkVHSobfA/J BX8AS9ve0bZp4Pi2MddF06wfP1hb2DCtd9QeFUlG1g0Z8jgyfRKVtBkmyghnH/M1t33M McyMM65QhXb74DRQGHb57pMHBwTl4m5CBEsBOcwHupLrtWwV8I82D62WCkwiUZRpxhOD wklhOxYwnNAVZlt4Yy43hF+B+j9ia6pAIT4e0pXLpnInmWXC3aLU6i8uPg9Zr8+f/vqa fpdBzsBWS2hq6SPE3AZFGlTDoHGF0L501U/vgGRI2wZOCkvb3METrOIvBaUoUATnNKyK Qbpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=l8e9yGgq6oC4DQrPhOZ/ZsN+g+gqHHnPzooWtUgPKZk=; b=whKy5LCA7w1HXjYRRKcv4NzjiQB4JjzoWG4sVugHc4lE9vn/OWGpqh7kXCboSGsgkz bHMh63SU+6/mzbZKVl6lQLNXKIuvgCyqUD0ensegKhw/VX8uaScDUuYFadwZMcNLw1EY YiahDsf62ssSvgWEQwqicSiYWm+ny6I6Ynb7y2p6IARPhYu76727fIo3RNTDA6o9d0io cbnpJzkEuM9OREmiHVd+dVl+SHp6pa48IKP9j4I3NdTTq1wrsrKXQtpm16cBGLJs8+5/ PLB62M5zZWwOkh4WICUAeqFPGpKzclgAO2hBF/BjXO8XOB34/gSBhmxGt0DB2v9vw+NB Tf2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TV5HJ0qw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jy8-20020a170907762800b0073cf6fbd19esi11100530ejc.343.2022.09.01.06.05.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 06:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TV5HJ0qw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D17CC3858D3C for ; Thu, 1 Sep 2022 13:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D17CC3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662037547; bh=l8e9yGgq6oC4DQrPhOZ/ZsN+g+gqHHnPzooWtUgPKZk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TV5HJ0qwISZjJPVFCNg3ERSnQCoXIrTBtlg3puLVSOvbzFfY5/8YTi4HY5u5zAFTy gZQYSxUY0laDQl4vsGYTRUnp+ziO2xXxpMUAMCSLy5XhzMQSgbDlkKDV+j6ipjAVOI RgMYkbyJighVL0TVw0l3FNKcEdt5Yi/CU4QAopHk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id CDB683858D37 for ; Thu, 1 Sep 2022 13:05:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDB683858D37 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 919382007C for ; Thu, 1 Sep 2022 13:04:59 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8E30A2C141 for ; Thu, 1 Sep 2022 13:04:59 +0000 (UTC) Date: Thu, 1 Sep 2022 13:04:59 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Some predicate analysis TLC User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20220901130547.D17CC3858D3C@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742772685264667272?= X-GMAIL-MSGID: =?utf-8?q?1742772685264667272?= The following hides some internal details of compute_control_dep_chain. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * gimple-predicate-analysis.cc (compute_control_dep_chain): New wrapping overload. (uninit_analysis::init_use_preds): Simplify. (uninit_analysis::init_from_phi_def): Likewise. --- gcc/gimple-predicate-analysis.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index eb1e11cead8..2982268fdfd 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -1124,6 +1124,18 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, return found_cd_chain; } +static bool +compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, + vec cd_chains[], unsigned *num_chains, + unsigned in_region = 0) +{ + auto_vec cur_cd_chain; + unsigned num_calls = 0; + unsigned depth = 0; + return compute_control_dep_chain (dom_bb, dep_bb, cd_chains, num_chains, + cur_cd_chain, &num_calls, in_region, depth); +} + /* Implemented simplifications: 1) ((x IOR y) != 0) AND (x != 0) is equivalent to (x != 0); @@ -1919,13 +1931,10 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb, Each DEP_CHAINS element is a series of edges whose conditions are logical conjunctions. Together, the DEP_CHAINS vector is used below to initialize an OR expression of the conjunctions. */ - unsigned num_calls = 0; unsigned num_chains = 0; auto_vec dep_chains[MAX_NUM_CHAINS]; - auto_vec cur_chain; - if (!compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains, - cur_chain, &num_calls)) + if (!compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains)) { gcc_assert (num_chains == 0); simple_control_dep_chain (dep_chains[0], cd_root, use_bb); @@ -2023,14 +2032,12 @@ uninit_analysis::init_from_phi_def (gphi *phi) unsigned num_chains = 0; auto_vec dep_chains[MAX_NUM_CHAINS]; - auto_vec cur_chain; for (unsigned i = 0; i < nedges; i++) { edge e = def_edges[i]; - unsigned num_calls = 0; unsigned prev_nc = num_chains; compute_control_dep_chain (cd_root, e->src, dep_chains, - &num_chains, cur_chain, &num_calls, in_region); + &num_chains, in_region); /* Update the newly added chains with the phi operand edge. */ if (EDGE_COUNT (e->src->succs) > 1)