From patchwork Thu Apr 18 17:04:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1087738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-499450-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="VD7iVyKg"; 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 44lQSy6xR5z9s3Z for ; Fri, 19 Apr 2019 03:04:47 +1000 (AEST) 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=ULT/WESZnVxWjl5onC9huhVBVaaS3KT+ORan9cVihd8iJHI7iQEEI lIn8wLeKFzluD4k7e10F/1y6CP3WBUVHJYuDq+YCRl0SwUJLa87acqzyZ/XxL3o3 f/MEMgyvBnUPuWGyeS5/JsHFayiXZRvSb21L4pQHVaS7MGWqLOxx8Y= 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=z9flSGdPpvK0MiHbkfl3JOip3Cw=; b=VD7iVyKgVmBHjeWhizye UEihYfbFDkQ1Ex6h4BAkiT1pcPdUDdl6+7bn4bcJym89lqpgTnHM8HCGp9OZfpd/ z48GdIp/8mS7ZrjWtkiopSsVjhauXiB2xHMLtKZKBaZZ3dvX2LSLIstRiEViKmF4 a9McOQJSEsVlNCVQh0VJuwg= Received: (qmail 49301 invoked by alias); 18 Apr 2019 17:04:39 -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 49288 invoked by uid 89); 18 Apr 2019 17:04:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=triggers, comitted 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; Thu, 18 Apr 2019 17:04:17 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 17D87281F23; Thu, 18 Apr 2019 19:04:14 +0200 (CEST) Date: Thu, 18 Apr 2019 19:04:14 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix inliner ICE with flattening Message-ID: <20190418170414.l3cjiyaw3ft6jdnc@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, the testcase (which I fialed to annotate correctly for testsuite) triggers situation where we forget to update overall summary after flattenin and later ICE in verification that estimates match. Bootstrapped/regtested x86_64-linux, comitted. Index: ChangeLog =================================================================== --- ChangeLog (revision 270444) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2019-04-18 Jan Hubicka + + PR ipa/85051 + * ipa-inline.c (flatten_function): New parameter UPDATE. + (ipa_inline, early_inliner): Use it. + 2019-04-18 Richard Sandiford * fold-const.c (int_const_binop): Return early on failure. Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 270444) +++ ipa-inline.c (working copy) @@ -2134,7 +2134,7 @@ inline_small_functions (void) at IPA inlining time. */ static void -flatten_function (struct cgraph_node *node, bool early) +flatten_function (struct cgraph_node *node, bool early, bool update) { struct cgraph_edge *e; @@ -2164,7 +2164,7 @@ flatten_function (struct cgraph_node *no it in order to fully flatten the leaves. */ if (!e->inline_failed) { - flatten_function (callee, early); + flatten_function (callee, early, false); continue; } @@ -2204,14 +2204,15 @@ flatten_function (struct cgraph_node *no inline_call (e, true, NULL, NULL, false); if (e->callee != orig_callee) orig_callee->aux = (void *) node; - flatten_function (e->callee, early); + flatten_function (e->callee, early, false); if (e->callee != orig_callee) orig_callee->aux = NULL; } node->aux = NULL; - if (!node->global.inlined_to) - ipa_update_overall_fn_summary (node); + if (update) + ipa_update_overall_fn_summary (node->global.inlined_to + ? node->global.inlined_to : node); } /* Inline NODE to all callers. Worker for cgraph_for_node_and_aliases. @@ -2519,7 +2520,7 @@ ipa_inline (void) function. */ if (dump_file) fprintf (dump_file, "Flattening %s\n", node->name ()); - flatten_function (node, false); + flatten_function (node, false, true); } if (j < nnodes - 2) @@ -2782,7 +2783,7 @@ early_inliner (function *fun) if (dump_enabled_p ()) dump_printf (MSG_OPTIMIZED_LOCATIONS, "Flattening %C\n", node); - flatten_function (node, true); + flatten_function (node, true, true); inlined = true; } else