From patchwork Tue Nov 12 19:36:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1193795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513166-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="eQbW4M3g"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CJ0M3qzgz9sNH for ; Wed, 13 Nov 2019 06:36:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=EoBaBvfGoFz2rpXLaBMY71cwIr1dUfKRlyOGIGsips0I6rWfjklba 1NMKNtFGJQ5l0WrFXDZ3RN7Ga/wzKA5R3h90xFps7K3Va1GMkutXkJdiNOjKu+Mg 0ZtHU8WXwPCsxW2WiqAbzs2CfY0XwTFCj/SCIhWPXgcXyOumn17XK0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=+Ak2L4q3DW/OJwFE+vLIQ8e+LrQ=; b=eQbW4M3gDJqD+t1iZwuY IiimNgKCSPY03Dlk/ML/dVWMBU3rKcFd5y/NZwjLu2nHImBbyPmIyrT8xxpKkrly di5PV9TBBOS8MPdav1KniIIgGYkJaZ1ismWqWpD7xaczN3JBFs7Q0Ib9b9igLkol U2RXINOd/9tm3vxCVcQc1IA= Received: (qmail 67581 invoked by alias); 12 Nov 2019 19:36:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67573 invoked by uid 89); 12 Nov 2019 19:36:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Nov 2019 19:36:43 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id E1C462805F0; Tue, 12 Nov 2019 20:36:40 +0100 (CET) Date: Tue, 12 Nov 2019 20:36:40 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, mjambor@suse.cz Subject: Fix ICE in ipa-cp when mixing -O0 and -O2 code in LTO Message-ID: <20191112193640.gnm4u6aek6gy75tz@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this fixes second ICE seen during profiledbootstrap with Ada enabled. The problem is that Ada builds some object files with -O2 -O0 (not sure why) and these functions get flag_ipa_cp but !optimize. Because of -O0 ipa-cp pass is not run at compile time and summaries are never produced. So In addition to !flag_ipa_cp functions we also need to punt on !optimize. This is something we may want to clean up next stage1. Bootstrapped/regtesetd x86_64-linux, comited * ipa-cp.c (ignore_edge_p): Also look for optimize flag. (ipcp_verify_propagated_values): Likewise. (propagate_constants_across_call): Likewise. (propagate_constants_topo): Likewise. (ipcp_propagate_stage): Likewise. Index: ipa-cp.c =================================================================== --- ipa-cp.c (revision 278094) +++ ipa-cp.c (working copy) @@ -816,6 +816,8 @@ ignore_edge_p (cgraph_edge *e) = e->callee->function_or_virtual_thunk_symbol (&avail, e->caller); return (avail <= AVAIL_INTERPOSABLE + || !opt_for_fn (e->caller->decl, optimize) + || !opt_for_fn (ultimate_target->decl, optimize) || !opt_for_fn (e->caller->decl, flag_ipa_cp) || !opt_for_fn (ultimate_target->decl, flag_ipa_cp)); } @@ -1471,7 +1473,8 @@ ipcp_verify_propagated_values (void) FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) { class ipa_node_params *info = IPA_NODE_REF (node); - if (!opt_for_fn (node->decl, flag_ipa_cp)) + if (!opt_for_fn (node->decl, flag_ipa_cp) + || !opt_for_fn (node->decl, optimize)) continue; int i, count = ipa_get_param_count (info); @@ -2316,7 +2319,9 @@ propagate_constants_across_call (struct parms_count = ipa_get_param_count (callee_info); if (parms_count == 0) return false; - if (!args) + if (!args + || !opt_for_fn (cs->caller->decl, flag_ipa_cp) + || !opt_for_fn (cs->caller->decl, optimize)) { for (i = 0; i < parms_count; i++) ret |= set_all_contains_variable (ipa_get_parm_lattices (callee_info, @@ -3238,7 +3243,8 @@ propagate_constants_topo (class ipa_topo FOR_EACH_VEC_ELT (cycle_nodes, j, v) if (v->has_gimple_body_p ()) { - if (opt_for_fn (v->decl, flag_ipa_cp)) + if (opt_for_fn (v->decl, flag_ipa_cp) + && opt_for_fn (v->decl, optimize)) push_node_to_stack (topo, v); /* When V is not optimized, we can not push it to stac, but still we need to set all its callees lattices to bottom. */ @@ -3269,7 +3275,8 @@ propagate_constants_topo (class ipa_topo their topological sort. */ FOR_EACH_VEC_ELT (cycle_nodes, j, v) if (v->has_gimple_body_p () - && opt_for_fn (v->decl, flag_ipa_cp)) + && opt_for_fn (v->decl, flag_ipa_cp) + && opt_for_fn (v->decl, optimize)) { struct cgraph_edge *cs; @@ -3348,7 +3355,9 @@ ipcp_propagate_stage (class ipa_topo_inf FOR_EACH_DEFINED_FUNCTION (node) { - if (node->has_gimple_body_p () && opt_for_fn (node->decl, flag_ipa_cp)) + if (node->has_gimple_body_p () + && opt_for_fn (node->decl, flag_ipa_cp) + && opt_for_fn (node->decl, optimize)) { class ipa_node_params *info = IPA_NODE_REF (node); determine_versionability (node, info);