From patchwork Fri Oct 17 19:50:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 400620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 5B399140081 for ; Sat, 18 Oct 2014 06:53:33 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=BVSQlocUrSCMAInmFJNxJrzyXxYJSYJFKpaRMo7szZK10aq6qjv7W Y0l+kd8d4t8D61PLNZyEpWyAZ3SmBPYyM5F77Z1PY/lCUiB8al1lbxwuNSLwKzi7 HoZEZftIdoQLURLtoVR6VBweto0VwndUgC7hFspPdZeWGd6dFndsSo= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=QsAinulIu5tDjeO4+mNQjDC+Zwc=; b=mDsJnPD4UOPGIZlCkANtGCnF50G2 D2y0t9qyCZqE4pb4Pz5/5+A6Z0nEWXbvZc24KVjXegXgCIp/rSt4a2uhMxLcb0Cz TspBmCnzw2J+DT9bOxPZDD2mhhiZDPDpmn5lXaW5p/ZjdJk1EUXEnibww7y367b9 qGN8cQTAISEbWP8= Received: (qmail 12010 invoked by alias); 17 Oct 2014 19:53:27 -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 11999 invoked by uid 89); 17 Oct 2014 19:53:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 17 Oct 2014 19:53:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 2AD26275A5B7; Fri, 17 Oct 2014 21:53:23 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZzmNFxByoADn; Fri, 17 Oct 2014 21:53:23 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 027E5275A444; Fri, 17 Oct 2014 21:53:22 +0200 (CEST) From: Eric Botcazou To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org Subject: Re: [patch] Fix ICE during LTRANS on big Ada application Date: Fri, 17 Oct 2014 21:50:47 +0200 Message-ID: <2759982.4itHzuo5ZA@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) In-Reply-To: <20141015200409.GB21865@kam.mff.cuni.cz> References: <15700032.Vfff8vmhaG@polaris> <2240629.yAX7Fe0x2x@polaris> <20141015200409.GB21865@kam.mff.cuni.cz> MIME-Version: 1.0 > Yes, this looks OK. Inliner coul also take care to turn the master clone > into unanalyzed node as remove_unreachable_nodes would, but I do not think > it is worth the effort. Please put the loop later in the function so it > does not slow things down unnecesarily (there are often many inline clones) Here's what I have installed on the mainline after re-testing, this defers the check as much as possible. 2014-10-17 Eric Botcazou * ipa-inline-transform.c (master_clone_with_noninline_clones_p): New. (clone_inlined_nodes): Do not overwrite the clone if above predicate returns true. Index: ipa-inline-transform.c =================================================================== --- ipa-inline-transform.c (revision 216252) +++ ipa-inline-transform.c (working copy) @@ -122,6 +122,20 @@ can_remove_node_now_p (struct cgraph_nod return true; } +/* Return true if NODE is a master clone with non-inline clones. */ + +static bool +master_clone_with_noninline_clones_p (struct cgraph_node *node) +{ + if (node->clone_of) + return false; + + for (struct cgraph_node *n = node->clones; n; n = n->next_sibling_clone) + if (n->decl != node->decl) + return true; + + return false; +} /* E is expected to be an edge being inlined. Clone destination node of the edge and redirect it to the new clone. @@ -155,7 +169,10 @@ clone_inlined_nodes (struct cgraph_edge /* Recursive inlining never wants the master clone to be overwritten. */ && update_original - && can_remove_node_now_p (e->callee, e)) + && can_remove_node_now_p (e->callee, e) + /* We cannot overwrite a master clone with non-inline clones + until after these clones are materialized. */ + && !master_clone_with_noninline_clones_p (e->callee)) { /* TODO: When callee is in a comdat group, we could remove all of it, including all inline clones inlined into it. That would however