From patchwork Wed Jan 12 14:48:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 49919 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 594E3394082C for ; Wed, 12 Jan 2022 14:50:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 594E3394082C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641999003; bh=tMaTlzfpusMKSW4PoWlLy7JyUUt1yO3YaUHMufrW1/I=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=GnOmHc5DXFhsBrSl1XrIubQnsmsDIIjAAxFvRYWH6d5tsk+WKIjD9ngK5cKtgzmqf pnWzS7okPAod0OW9fFsWGeHarenQp1IJEh94VXwxRSkxEsYUwGAIzlInBkd6etNlrz ZwmLe0xFu8s6BMuhhqrCtrGTRN4AOWWPAF88+cbw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 76EA63940827 for ; Wed, 12 Jan 2022 14:48:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76EA63940827 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2EB871F39B for ; Wed, 12 Jan 2022 14:48:01 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1B23C13B65 for ; Wed, 12 Jan 2022 14:48:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +a+aBSHq3mH0CgAAMHmgww (envelope-from ) for ; Wed, 12 Jan 2022 14:48:01 +0000 Date: Wed, 12 Jan 2022 15:48:00 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/103990 - fix CFG cleanup regression from PRE change Message-ID: <7ns7ro2-n33o-q884-os8o-12oq5rn57rp6@fhfr.qr> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This adjusts the CFG cleanup flow back to what it was before the last change which fixes the observed regression of 541.leela_r with LTO and FDO. Boostrapped on x86_64-unknown-linux-gnu, testing in progress. 2022-01-12 Richard Biener PR tree-optimization/103990 * tree-pass.h (tail_merge_optimize): Drop unused argument. * tree-ssa-tail-merge.c (tail_merge_optimize): Likewise. * tree-ssa-pre.c (pass_pre::execute): Retain TODO_cleanup_cfg and adjust call to tail_merge_optimize. --- gcc/tree-pass.h | 2 +- gcc/tree-ssa-pre.c | 6 ++---- gcc/tree-ssa-tail-merge.c | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 36097cf2736..606d1d60b85 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -412,7 +412,7 @@ extern gimple_opt_pass *make_pass_early_thread_jumps (gcc::context *ctxt); extern gimple_opt_pass *make_pass_split_crit_edges (gcc::context *ctxt); extern gimple_opt_pass *make_pass_laddress (gcc::context *ctxt); extern gimple_opt_pass *make_pass_pre (gcc::context *ctxt); -extern unsigned int tail_merge_optimize (unsigned int, bool); +extern unsigned int tail_merge_optimize (bool); extern gimple_opt_pass *make_pass_profile (gcc::context *ctxt); extern gimple_opt_pass *make_pass_strip_predict_hints (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_complex_O0 (gcc::context *ctxt); diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index ab24fa98a1f..5113256802e 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4442,7 +4442,6 @@ pass_pre::execute (function *fun) if (todo & TODO_cleanup_cfg) { cleanup_tree_cfg (); - todo &= ~TODO_cleanup_cfg; need_crit_edge_split = true; } @@ -4458,9 +4457,8 @@ pass_pre::execute (function *fun) It should either: - call merge_blocks after each tail merge iteration - call merge_blocks after all tail merge iterations - - mark TODO_cleanup_cfg when necessary - - share the cfg cleanup with fini_pre. */ - todo |= tail_merge_optimize (todo, need_crit_edge_split); + - mark TODO_cleanup_cfg when necessary. */ + todo |= tail_merge_optimize (need_crit_edge_split); free_rpo_vn (); diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index fd333800f0f..8e1ea1a982e 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1724,7 +1724,7 @@ update_debug_stmts (void) /* Runs tail merge optimization. */ unsigned int -tail_merge_optimize (unsigned int todo, bool need_crit_edge_split) +tail_merge_optimize (bool need_crit_edge_split) { int nr_bbs_removed_total = 0; int nr_bbs_removed; @@ -1814,5 +1814,5 @@ tail_merge_optimize (unsigned int todo, bool need_crit_edge_split) timevar_pop (TV_TREE_TAIL_MERGE); - return todo; + return 0; }