From patchwork Sat Nov 27 00:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 1560369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=z59UqgPE; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=dEgINFVp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J1BhS61ZSz9sf8 for ; Sat, 27 Nov 2021 11:05:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CA053857C70 for ; Sat, 27 Nov 2021 00:05:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 63B5D3858D39 for ; Sat, 27 Nov 2021 00:05:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 63B5D3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4B25C218D6 for ; Sat, 27 Nov 2021 00:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637971500; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=LpJT1lm2HSj8HjyaWusP4//UULHVqHvmOVBHHGMMHig=; b=z59UqgPE+jC9OpSyimLn04BqihlMkhTvFYsHkSyZEJktPUDU7o4rFJFd6EVPe9daQ2mJ+X 1H2KCQeQbXhTP8C4K3+aecO2oFrYVDmQkhxeCU9zHvnVHUllnyD5Fad31hVkYtV7Co297Z LJh+hUHZnDQlevZExT5zO3ZgkSIwuH0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637971500; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=LpJT1lm2HSj8HjyaWusP4//UULHVqHvmOVBHHGMMHig=; b=dEgINFVpmJlrB9GY6qDyaUT4HEMQ4JrrKxFdpFBF8toDipgRzvmVc4R4hs56pyJe51p5G7 XaGbSFzCrWX5PQDQ== Received: from suse.cz (virgil.suse.cz [10.100.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 36215A3B85 for ; Sat, 27 Nov 2021 00:05:00 +0000 (UTC) From: Martin Jambor To: GCC Patches Cc: Subject: [PATCH] ipa: Fix CFG fix-up in IPA-CP transform phase (PR 103441) User-Agent: Notmuch/0.34.1 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Sat, 27 Nov 2021 01:05:00 +0100 Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, I forgot that IPA passes before ipa-inline must not return TODO_cleanup_cfg from their transformation function because ordinary CFG cleanup does not remove call graph edges associated with removed call statements but must use delete_unreachable_blocks_update_callgraph instead. This patch fixes that error. Pre-approved by Honza, bootstrapped and tested on x86_64-linux, I also verified it restores go bootstrap on ppc64le-linux, pushed. Sorry for the breakage, Martin gcc/ChangeLog: 2021-11-26 Martin Jambor PR ipa/103441 * ipa-prop.c (ipcp_transform_function): Call delete_unreachable_blocks_update_callgraph instead of returning TODO_cleanup_cfg. --- gcc/ipa-prop.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index a297f50e945..bc5643206b9 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -6001,7 +6001,6 @@ ipcp_transform_function (struct cgraph_node *node) struct ipa_func_body_info fbi; struct ipa_agg_replacement_value *aggval; int param_count; - bool something_changed = false; gcc_checking_assert (cfun); gcc_checking_assert (current_function_decl); @@ -6022,14 +6021,16 @@ ipcp_transform_function (struct cgraph_node *node) ipa_populate_param_decls (node, *descriptors); std::pair rr = adjust_agg_replacement_values (node, aggval, *descriptors); - int retval = rr.second ? TODO_cleanup_cfg : 0; + bool cfg_changed = rr.second; if (!rr.first) { vec_free (descriptors); if (dump_file) fprintf (dump_file, " All affected aggregate parameters were either " "removed or converted into scalars, phase done.\n"); - return retval; + if (cfg_changed) + delete_unreachable_blocks_update_callgraph (node, false); + return 0; } if (dump_file) ipa_dump_agg_replacement_values (dump_file, aggval); @@ -6041,11 +6042,12 @@ ipcp_transform_function (struct cgraph_node *node) fbi.param_count = param_count; fbi.aa_walk_budget = opt_for_fn (node->decl, param_ipa_max_aa_steps); + bool modified_mem_access = false; calculate_dominance_info (CDI_DOMINATORS); - ipcp_modif_dom_walker walker (&fbi, descriptors, aggval, &something_changed); + ipcp_modif_dom_walker walker (&fbi, descriptors, aggval, &modified_mem_access); walker.walk (ENTRY_BLOCK_PTR_FOR_FN (cfun)); free_dominance_info (CDI_DOMINATORS); - bool cfg_changed = walker.cleanup_eh (); + cfg_changed |= walker.cleanup_eh (); int i; struct ipa_bb_info *bi; @@ -6059,14 +6061,10 @@ ipcp_transform_function (struct cgraph_node *node) s->m_vr = NULL; vec_free (descriptors); - - if (!something_changed) - return retval; - if (cfg_changed) delete_unreachable_blocks_update_callgraph (node, false); - return retval | TODO_update_ssa_only_virtuals; + return modified_mem_access ? TODO_update_ssa_only_virtuals : 0; }