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: 58242 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62826385482D for ; Fri, 30 Sep 2022 23:06:07 +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-Google-Smtp-Source: AMsMyM4is1hAgZuKuOyia2bNeFSQMOtFbhA3+c3xZ7Sbqbo3LRMRvGE16Q9hEItg7eItri5I4c0OCQ== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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); } }