From patchwork Wed Apr 19 13:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 85412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp399814vqo; Wed, 19 Apr 2023 06:43:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YNRFzMqpcZOjp+FGmv21po9pdoEyGMfuBymnvBw+QNYdEccaaxgn1FZNF+1cvo/Q5APv03 X-Received: by 2002:aa7:d3d3:0:b0:508:4232:e56f with SMTP id o19-20020aa7d3d3000000b005084232e56fmr430254edr.39.1681911819910; Wed, 19 Apr 2023 06:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681911819; cv=none; d=google.com; s=arc-20160816; b=l3pSrq8BAP+K1gQmPEEf/Anf33aD3CvhAXEclVLN3tg8MMJRpMVw/J4e8G9TdcbLxu 8VF5xzsFPON8DhDIl3G6btV1FKV68z/+PLR3tckFpmVudvpST0+nB5VJcTeKFhVPx1GD htS0AlULokAFnCjti8jWNXeBPl41orKfNLCJQxcm41qdRBJSNjcvkLxEvdpi9cySr6lJ t7XFXJ5ZyQ5qzmhO9jxJl5IERsN3LbjIGY0weftu+bRYfqxmZ9PJ5/wZff2E38Yw8Hn5 178ZyCjOtqI80I2+eJc4jIq42NXgg2zE6jXyTucAaSoSo0Hm5TtXHiSS73EHH8imhhJy qMIw== 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=5RIwL4Sbm0GOimzavz3tKpsuTr4U33uWIDKgNRckK+A=; b=P/jNsj0SrPY2Rt9T+/fhCBeRALoZIShyodoCSb21qHax5c0EowUrhD8PxEvL1OXApi BV6IGX6sfqPdV2uT5Pbl234CpOmLF7H7kTVqXMP34hAMgDlKJQfGNt9DzoadS0VWs2Ar IxhEGM31vW5XndcaWRUD7TLm7CF1AxSEtFXGiSOmmRnTenreIwLogcqq25P9pDuEW8ac W9y8xRSMQ5XgvYPMWuOJQlaAyOl2PcQ80jSooDLdqJntrxZPjrmsnqVw9uoLGcFCxkqL APLHwQAYc/vPqL+G3WbmqxtdqihxDmFBtUtGDA0mj21x9yW7QCi1RWcyyPJMg10zuDCh Dl7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Mvf0AHYj; 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 f14-20020aa7d84e000000b005029d16fcebsi16114800eds.649.2023.04.19.06.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 06:43:39 -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=Mvf0AHYj; 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 E80E5385772D for ; Wed, 19 Apr 2023 13:43:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E80E5385772D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681911812; bh=5RIwL4Sbm0GOimzavz3tKpsuTr4U33uWIDKgNRckK+A=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Mvf0AHYjui1wsBKK43IV6C7xagKMzQRSH970Wz8B4dC/4mKg/gL5mIKFKI9xNB7Bp l+Iqzqch0UQZalorzYLx04xrEHE1q6EpqCL0lSwJ94B08iibX+dCn4FZoT9C2PZZWL UKdsarXgSW9suvMTxI+5YS0HHBtjrrRwhX7mcY9k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 20D153858D33 for ; Wed, 19 Apr 2023 13:42:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20D153858D33 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4600821220 for ; Wed, 19 Apr 2023 13:42:49 +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 3CBEF2C141 for ; Wed, 19 Apr 2023 13:42:49 +0000 (UTC) Date: Wed, 19 Apr 2023 13:42:49 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] Split out solve_add_graph_edge 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: <20230419134332.E80E5385772D@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763612368657537365?= X-GMAIL-MSGID: =?utf-8?q?1763612368657537365?= Split out a worker with all the special-casings when adding a graph edge during solving. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-ssa-structalias.cc (solve_add_graph_edge): New function, split out from ... (do_sd_constraint): ... here. --- gcc/tree-ssa-structalias.cc | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index 39c342fae41..84c625d53e5 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -1640,6 +1640,29 @@ topo_visit (constraint_graph_t graph, struct topo_info *ti, ti->topo_order.safe_push (n); } +/* Add a copy edge FROM -> TO, optimizing special cases. Returns TRUE + if the solution of TO changed. */ + +static bool +solve_add_graph_edge (constraint_graph_t graph, unsigned int to, + unsigned int from) +{ + /* Adding edges from the special vars is pointless. + They don't have sets that can change. */ + if (get_varinfo (from)->is_special_var) + return bitmap_ior_into (get_varinfo (to)->solution, + get_varinfo (from)->solution); + /* Merging the solution from ESCAPED needlessly increases + the set. Use ESCAPED as representative instead. */ + else if (from == find (escaped_id)) + return bitmap_set_bit (get_varinfo (to)->solution, escaped_id); + else if (get_varinfo (from)->may_have_pointers + && add_graph_edge (graph, to, from)) + return bitmap_ior_into (get_varinfo (to)->solution, + get_varinfo (from)->solution); + return false; +} + /* Process a constraint C that represents x = *(y + off), using DELTA as the starting solution for y. */ @@ -1700,17 +1723,7 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, { t = find (v->id); - /* Adding edges from the special vars is pointless. - They don't have sets that can change. */ - if (get_varinfo (t)->is_special_var) - flag |= bitmap_ior_into (sol, get_varinfo (t)->solution); - /* Merging the solution from ESCAPED needlessly increases - the set. Use ESCAPED as representative instead. */ - else if (t == find (escaped_id)) - flag |= bitmap_set_bit (sol, escaped_id); - else if (v->may_have_pointers - && add_graph_edge (graph, lhs, t)) - flag |= bitmap_ior_into (sol, get_varinfo (t)->solution); + flag |= solve_add_graph_edge (graph, lhs, t); if (v->is_full_var || v->next == 0)