From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id AE0823858D39 for ; Tue, 19 Oct 2021 12:35:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE0823858D39 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 4D0E42825AF; Tue, 19 Oct 2021 14:35:47 +0200 (CEST) Date: Tue, 19 Oct 2021 14:35:47 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Cleanup compute_points_to_sets Message-ID: <20211019123547.GC60635@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 19 Oct 2021 12:35:50 -0000 Hi, this patch fixes two issues I noticed while proofreading the code. First is that I have added conditional around setting of nonlocal and escaped flags (since they may be set from solver) while keeping the variable in assignment that is confusing. Second is that we still do not set pt in the case function has no memory side effects. In this case the call use is not going to be used since uses_global_memory is false only if either function is const or modref determined that all loads are from memory pointed to by parameters. In both cases we will disambiguate earlier before asking PTA oracle, but it is better to avoid stale PTA sets (which shows in -alias dumps etc.) Most of builtins are not modifying global memory, one option would be to stick another flag into the fnspecs strings for this property. Bootstrapped/regtested x86_64-linux, OK? Honza gcc/ChangeLog: * tree-ssa-structalias.c (compute_points_to_sets): Cleanup. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 2e6513bb72a..35971a54e02 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -7550,8 +7550,8 @@ compute_points_to_sets (void) always escaped. */ if (uses_global_memory) { - pt->nonlocal = uses_global_memory; - pt->escaped = uses_global_memory; + pt->nonlocal = 1; + pt->escaped = 1; } } else if (uses_global_memory) @@ -7561,6 +7561,8 @@ compute_points_to_sets (void) *pt = cfun->gimple_df->escaped; pt->nonlocal = 1; } + else + memset (pt, 0, sizeof (struct pt_solution)); } pt = gimple_call_clobber_set (stmt); @@ -7582,8 +7584,8 @@ compute_points_to_sets (void) always escaped. */ if (writes_global_memory) { - pt->nonlocal = writes_global_memory; - pt->escaped = writes_global_memory; + pt->nonlocal = 1; + pt->escaped = 1; } } else if (writes_global_memory) @@ -7593,6 +7595,8 @@ compute_points_to_sets (void) *pt = cfun->gimple_df->escaped; pt->nonlocal = 1; } + else + memset (pt, 0, sizeof (struct pt_solution)); } } }