From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 240803858C55; Fri, 30 Sep 2022 23:04:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 240803858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664579096; bh=LzA7e+zrKAE3kpBWg6SMY1N9JRPNuRA36CLe+9cGV3o=; h=From:To:Subject:Date:From; b=p6vTOZCabACOy43v+MjKlMmgYoFnvvQS0CKvXZk3mE3eJ6xuJwtYyrVxUHZjq7Y/8 A4pTDJFTUD1NdvfTqXqp2DvANitpU8DkX8Awsf5k+LCXQK+s0TTYcssIDeJm1Vy1DJ +yiabbxUOkc5lSJWhQVV5hWyYAcgMSGPy8kFuRlY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3003] Minor cleanup/prep in DOM X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 2002c54cb7f183c27ad7a5c294b868930cea17db X-Git-Newrev: 89b5a316cffa4a9fa2504e776a4cdc2ef492f00b Message-Id: <20220930230456.240803858C55@sourceware.org> Date: Fri, 30 Sep 2022 23:04:56 +0000 (GMT) List-Id: https://gcc.gnu.org/g:89b5a316cffa4a9fa2504e776a4cdc2ef492f00b commit r13-3003-g89b5a316cffa4a9fa2504e776a4cdc2ef492f00b 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: --- gcc/tree-ssa-dom.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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); } }