From patchwork Fri Sep 30 23:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp24135wrs; Fri, 30 Sep 2022 16:06:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65VUVkMvl5QQV6zmHl73y9RAYUK9IuUzht3LFzYL2fCGg4UyuvOdwpzZfPa00ugusPN1sJ X-Received: by 2002:a05:6402:278c:b0:451:fabf:d885 with SMTP id b12-20020a056402278c00b00451fabfd885mr9498343ede.91.1664579179405; Fri, 30 Sep 2022 16:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664579179; cv=none; d=google.com; s=arc-20160816; b=dJ0uqaViu6Kc2RlqPZ9Pw0yZS3r6ff8ktaY+ye7gimxaW+M7nerx14GiTYUHdoHLDP h9uzVpn6D234Y8yEbOrM7a8bEyH/Koxd+xIrCdmRzFegJwEfv67k5IfdptzZ1xKud2A5 bbqFdilldgG22LK4Oj+aosMtGUFxDmOxzanXJSwSjr6eI0jxaooEfMKWUwAVzhvi4BYd qdM4l9/RAvFAZL8wuRs3ooW5FX3Rqkq3L9OTB9pwrDqcpkloqwxlE7fDOgPgQFe+co6M aLIxFL4Gre9Cf8rd70dF5xByoZ2+Di8IIv4Q88fW5FDxeI+AVasjOCZYRRKMX8XwIfou l1mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :dkim-signature:dmarc-filter:delivered-to; bh=wFTGlnvoVgoLAqY4ZL1AU78hUPgh7uuYoy03AwtDfqg=; b=mg1pcOvh42Zt79iWyHYtyO9qInQCfuNFB64Nh5vUNG1B//rGCcjCQ3ieW9hBPm5CIT KNxyAHJDyF5fJL+S4fo/vNymBXgyaR/W9PZG9WUMV0e1gksIPxfG0vmyjHznTeji/Pc2 ypkjovnemx9IUnhRxRt6UBxansF+3OPzZTm8I8r4JdHEDGv+pFV4mzdPE2b7o+CK5IrA VZGUZOWKKlAyX9Hz5ufk5LmLPEshV0gOUXLQGW+zQnjOqhG2QWk1pDmLsFB0SkAvGIsV JXsOe80V9zbUBJe60yQ0oL/pDt5ivxq4WO/YxePRo9xXaeIZ6TO2igWhuwwgmO/6uN/B AziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=EMPsVfQc; 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" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s4-20020a17090699c400b00734be0d7167si2374340ejn.825.2022.09.30.16.06.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 16:06:19 -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=@ventanamicro.com header.s=google header.b=EMPsVfQc; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14772385482C for ; Fri, 30 Sep 2022 23:06:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 118ED3858C55 for ; Fri, 30 Sep 2022 23:05:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 118ED3858C55 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pg1-x532.google.com with SMTP id r62so5297498pgr.12 for ; Fri, 30 Sep 2022 16:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date; bh=wFTGlnvoVgoLAqY4ZL1AU78hUPgh7uuYoy03AwtDfqg=; b=EMPsVfQcfS8N2PH9ppekbGxZ2BXaEXVvx6b8UqPm3LKfQzf53Ep6LOrXxYk0FNkBsE Bp07x2nb1kmnFRr9f22PoYARj6I7T5WGpJJIeGB5fhqhpkI1nFGQ4J6gHnETYltm9gyw 6AT8nkU/GApoJuIXk0sjWCgXEBi3vjG/1kDr4p0oqDJt0jn7nnle43ymlEda5QOARNAo TtRZyfT7n1HqrGGCg8HTrDANmk/lT6Y2b7Z9HjWMATZYYUsVbBMhXC49O+VnZrop4i/7 tgG+8Dqlx+c86kkh+/I9h4nsdtwuKijv8OXLY9DoWsGhicgpkpTPpgBfndQ/12r4Sk9J AW1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=wFTGlnvoVgoLAqY4ZL1AU78hUPgh7uuYoy03AwtDfqg=; b=wxMh900yRos9VukRbrxyKEMnGmA31NCpNqMQ0Tqi522hyAiT9QLl7ky0NLlryJloOA flyA+uDgw5780SzJ5v1FRl2FSfHUvFg8VZSjUYse02fVMHSxsOBui2nnHWRgKeHNEMaQ QZfjKl838ttfymbM2zbMBY59vFM7Ud0+WA/iANMy8nvLxmIxNzuDpIl2qwVMc5B9QqAI IRyqqd8sbXScH/LF1kQVtq0NKDS9X7k+LU9KypqoKtJd1VG2md12WS1bBE+ya6YOJgVk cmsQgCs/KDxe6h/uPuiY/mmhYuZY61m4RHBj+YIF5ftm1vFki0OJoI+RTyD2YGrDtvAX lgIg== X-Gm-Message-State: ACrzQf1ArD/3W/C//MW+EB5mRfVvCp2gbjZlOq+3fdawRRLAoNTckWzn YIjsjeU4bkJvN/xOuiHwJAIsHDhud7MXAeCT X-Received: by 2002:a63:ff22:0:b0:43c:7840:bea3 with SMTP id k34-20020a63ff22000000b0043c7840bea3mr9414736pgi.362.1664579148795; Fri, 30 Sep 2022 16:05:48 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id e64-20020a17090a6fc600b002004760a66csm2204714pjk.13.2022.09.30.16.05.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Sep 2022 16:05:48 -0700 (PDT) Message-ID: <44815a60-2cd4-9408-64a9-d718163bca71@ventanamicro.com> Date: Fri, 30 Sep 2022 17:05:47 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" From: Jeff Law Subject: [committed] Minor cleanup/prep in DOM X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745437777682041322?= X-GMAIL-MSGID: =?utf-8?q?1745437777682041322?= It's a bit weird that free_dom_edge_info leaves a dangling pointer in e->aux.  Not sure what I was thinking. There's two callers.  One wipes e->aux immediately after the call, the other attaches a newly created object immediately after the call.  So we can wipe e->aux within the call and simplify one of the two call sites. This is preparatory work for a minor optimization where we want to detect another class of edge equivalences in DOM (until something better is available) and either attach them an existing edge_info structure or create a new one if one doesn't currently exist for a given edge. Bootstrapped and regression tested on x86_64.  Installing on the trunk. Jeff commit fbd95c027edcc169cc3b40806375fbabc08500e0 Author: Jeff Law Date: Fri Sep 30 18:59:24 2022 -0400 Minor cleanup/prep in DOM It's a bit weird that free_dom_edge_info leaves a dangling pointer in e->aux. Not sure what I was thinking. There's two callers. One wipes e->aux immediately after the call, the other attaches a newly created object immediately after the call. So we can wipe e->aux within the call and simplify one of the two call sites. This is preparatory work for a minor optimization where we want to detect another class of edge equivalences in DOM (until something better is available) and either attach them an existing edge_info structure or create a new one if one doesn't currently exist for a given edge. gcc/ * tree-ssa-dom.cc (free_dom_edge_info): Clear e->aux too. (free_all_edge_infos): Do not clear e->aux here. diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc index 84bef798f52..fa43dbe6c44 100644 --- a/gcc/tree-ssa-dom.cc +++ b/gcc/tree-ssa-dom.cc @@ -393,7 +393,8 @@ edge_info::record_simple_equiv (tree lhs, tree rhs) simple_equivalences.safe_push (equiv_pair (lhs, rhs)); } -/* Free the edge_info data attached to E, if it exists. */ +/* Free the edge_info data attached to E, if it exists and + clear e->aux. */ void free_dom_edge_info (edge e) @@ -402,6 +403,7 @@ free_dom_edge_info (edge e) if (edge_info) delete edge_info; + e->aux = NULL; } /* Free all EDGE_INFO structures associated with edges in the CFG. @@ -420,10 +422,7 @@ free_all_edge_infos (void) FOR_EACH_BB_FN (bb, cfun) { FOR_EACH_EDGE (e, ei, bb->preds) - { - free_dom_edge_info (e); - e->aux = NULL; - } + free_dom_edge_info (e); } }