From patchwork Wed Jan 17 20:42:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 862599 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-471527-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Wsx20EFf"; 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 3zMJtV52D5z9t66 for ; Thu, 18 Jan 2018 07:42:25 +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=n8TznZ5RjqCFloFC8CvTS/fSAQGT+c9pdCVq0xW4wbvIkxANDYGaz GynpTKCsUnoW8nwdzv0S9YQdQTaI8Yv3So1TQ9QK8c+Y8uSVF38GfuJ0ywd5TI2z Pd6T7nZFxNeB3fvRMpGS2dpblJ2Yw+ZHQ0MTS2WPaK/sVwPjh1nFz8= 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=GAGR5Li9NnxBeQzvX55bBL9JXos=; b=Wsx20EFf0g6C+Wlj2IAc pj28U/B9uZPNn5iL5LgsIU2C8o0O/zfnhLYfOfR39ZHIU6k0UK0bcBubb52IIh7/ whYm0avBMTg6MaKQRITJujHal2X2Lla3p/KM6tGuguEEXYja3oqH5akaGpuhizWY MRXVenrRq0Vbzv6jjjY3v1g= Received: (qmail 26658 invoked by alias); 17 Jan 2018 20:42:18 -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 26641 invoked by uid 89); 17 Jan 2018 20:42:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=lose 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; Wed, 17 Jan 2018 20:42:16 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 68E95546A15; Wed, 17 Jan 2018 21:42:13 +0100 (CET) Date: Wed, 17 Jan 2018 21:42:13 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix ICE with flatten on uninlinable call Message-ID: <20180117204213.GA74553@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Hi, this patch fixes ICE where we manage to lose the CIF_FINAL failure on inlining. Bootstrapped/regtested x86_64-linux, comitted. Honza PR ipa/83051 * ipa-inline.c (flatten_function): Do not overwrite final inlining failure. * gcc.c-torture/compile/pr83051-2.c: New testcase. Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 256795) +++ ipa-inline.c (working copy) @@ -2083,7 +2083,8 @@ flatten_function (struct cgraph_node *no "Not inlining %s into %s to avoid cycle.\n", xstrdup_for_dump (callee->name ()), xstrdup_for_dump (e->caller->name ())); - e->inline_failed = CIF_RECURSIVE_INLINING; + if (cgraph_inline_failed_type (e->inline_failed) != CIF_FINAL_ERROR) + e->inline_failed = CIF_RECURSIVE_INLINING; continue; } Index: testsuite/gcc.c-torture/compile/pr83051-2.c =================================================================== --- testsuite/gcc.c-torture/compile/pr83051-2.c (revision 0) +++ testsuite/gcc.c-torture/compile/pr83051-2.c (working copy) @@ -0,0 +1,12 @@ +/* { dg-options "-fno-early-inlining" } */ +void +bar () +{ + bar (0); +} + +__attribute__ ((flatten)) +void foo () +{ + bar (); +}