From patchwork Mon Oct 6 09:52:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 396761 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 E366F1400DE for ; Mon, 6 Oct 2014 20:53:18 +1100 (EST) 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ealz/drSHcHp6EGd +CaraQEHjJxxRwLLDYCgESnJxPrT+h9NGe6AbWVKv1KKDh20YhvIg3R8YAIclTBT eN8YGitKmQnVIm65zCGeVuTwBS+Yk0maWwrAeuYmY08K+EJZKufkPd05zmG3oFet C94JdgEZXZgT3dEGLgDerAJevNw= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=xWC/5bSVsqZcxQa5xgf+Iz vCc64=; b=VuvjD49/Fw7ACsoNpDlny8lfa/tPhFajwHs34wJDPpVIEyyCOMiSEX rEkj7Lk+GrXFQ6xGt8dV2DtZpUXmZaWhVXcFRIx5D/nIyM9Ta1oZNnbXHJ75NU6l Zru1OLPgZl//Xo1I0LTUYc+qIn7G50iis3gtRHsocmUQo70euTsdA= Received: (qmail 12151 invoked by alias); 6 Oct 2014 09:53:12 -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 12132 invoked by uid 89); 6 Oct 2014 09:53:10 -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; Mon, 06 Oct 2014 09:53:09 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 55F8E274FC74 for ; Mon, 6 Oct 2014 11:53:05 +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 ApTcritbCv-V for ; Mon, 6 Oct 2014 11:53:05 +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 31DE1274FA95 for ; Mon, 6 Oct 2014 11:53:04 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Work harder to find DECL_STRUCT_FUNCTION Date: Mon, 06 Oct 2014 11:52:24 +0200 Message-ID: <2181135.6JNuHbnjBK@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 Hi, you can have chains of clone functions in the callgraph but can_inline_edge_p stops at the first clone when it is looking for DECL_STRUCT_FUNCTION, which can fool the following conditions in the predicate. Tested on x86_64-suse-linux, OK for the mainline? 2014-10-06 Eric Botcazou * ipa-inline.c (can_inline_edge_p): Recurse on clones to find the DECL_STRUCT_FUNCTION of the original node. Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 215843) +++ ipa-inline.c (working copy) @@ -276,12 +276,24 @@ can_inline_edge_p (struct cgraph_edge *e struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl); struct function *callee_cfun = callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL; + struct cgraph_node *n; - if (!caller_cfun && e->caller->clone_of) - caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl); + n = e->caller; + while (!caller_cfun && n->clone_of) + { + n = n->clone_of; + caller_cfun = DECL_STRUCT_FUNCTION (n->decl); + } - if (!callee_cfun && callee && callee->clone_of) - callee_cfun = DECL_STRUCT_FUNCTION (callee->clone_of->decl); + if (callee) + { + n = callee; + while (!callee_cfun && n->clone_of) + { + n = n->clone_of; + callee_cfun = DECL_STRUCT_FUNCTION (n->decl); + } + } gcc_assert (e->inline_failed);