From patchwork Tue Apr 9 03:40:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyi Zhou X-Patchwork-Id: 234950 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id DA1F42C00A4 for ; Tue, 9 Apr 2013 13:40:54 +1000 (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; q=dns; s=default; b=d2aSbR+E3BmbwOl 3pQ1+OV0iMBYQUBpLEnu1MtkvE/ICvL/Aep+q5OBBcgX37w5OQfYa9QIyRxs7LTu PpgbZLecaokiQA/UCbggOafS4zK6DlUcmJ5h6DHsndZ8DWAyCFRjFpoRIe8Nn1tJ 1pnsX8yr33uA9l+RCRgwRCoF3jOI= 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; s=default; bh=0fMHTRYLO3edDSx6nDc/Q J7rzJo=; b=Nx+WFJcZ392MSarzlvZLivfYej+TVrUc5dtwiwpyc6/tW1LveTImQ uzorhcHV9JxDtSxHglKi5cFvLgTTxvPzScKAcziG0SO0CBx/pRyGtijKb9ZAqT+q AvjTOiGUJZ/7lNeErPo6Co8SRqOV58vSecPGhO1ZVqudVrKrfWcQIQ= Received: (qmail 25731 invoked by alias); 9 Apr 2013 03:40:47 -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 25714 invoked by uid 89); 9 Apr 2013 03:40:46 -0000 X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-da0-f43.google.com (HELO mail-da0-f43.google.com) (209.85.210.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Apr 2013 03:40:46 +0000 Received: by mail-da0-f43.google.com with SMTP id u36so2919066dak.16 for ; Mon, 08 Apr 2013 20:40:44 -0700 (PDT) X-Received: by 10.68.172.5 with SMTP id ay5mr375021pbc.73.1365478844385; Mon, 08 Apr 2013 20:40:44 -0700 (PDT) Received: from localhost.localdomain ([159.226.43.61]) by mx.google.com with ESMTPS id ef4sm337528pbd.38.2013.04.08.20.40.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 20:40:43 -0700 (PDT) From: Zhouyi Zhou To: gcc-patches@gcc.gnu.org, hubicka@gcc.gnu.org, richard.guenther@gmail.com Subject: Re: [PATCH v3]IPA: fixing inline fail report caused by overwritable functions. Date: Tue, 9 Apr 2013 11:40:24 +0800 Message-Id: <1365478824-7151-1-git-send-email-yizhouzhou@ict.ac.cn> On Mon, Apr 8, 2013 at 5:48 PM, Richard Biener wrote: >Can you trigger this message to show up with -Winline before/after the patch? >Can you please add a testcase then? Thanks Richard for reviewing, from my point of view about gcc and my invoking of gcc, -Winline only works on callees that be declared "inline", but if the callee is declared "inline", it will be AVAIL_AVAILABLE in function can_inline_edge_p, thus out of the range of my patch. So I only add a testcase for fixing the tree dump, are there any thing more I can do? Regtested/bootstrapped on x86_64-linux ChangeLog: 2013-04-08 Zhouyi Zhou * cif-code.def (OVERWRITABLE): correct the comment for overwritable function * ipa-inline.c (can_inline_edge_p): let dump mechanism report the inline fail caused by overwritable functions. * gcc.dg/tree-ssa/inline-11.c: New test Index: gcc/cif-code.def =================================================================== --- gcc/cif-code.def (revision 197549) +++ gcc/cif-code.def (working copy) @@ -48,7 +48,7 @@ DEFCIFCODE(REDEFINED_EXTERN_INLINE, /* Function is not inlinable. */ DEFCIFCODE(FUNCTION_NOT_INLINABLE, N_("function not inlinable")) -/* Function is not overwritable. */ +/* Function is overwritable. */ DEFCIFCODE(OVERWRITABLE, N_("function body can be overwritten at link time")) /* Function is not an inlining candidate. */ Index: gcc/testsuite/gcc.dg/tree-ssa/inline-11.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-einline" } */ +int w; +int bar (void) __attribute__ ((weak)); +int bar (){ + w++; +} +void foo() +{ + bar(); +} +/* { dg-final { scan-tree-dump-times "function body can be overwritten at link time" 1 "einline" } } */ +/* { dg-final { cleanup-tree-dump "einline" } } */ Index: gcc/ipa-inline.c =================================================================== --- gcc/ipa-inline.c (revision 197549) +++ gcc/ipa-inline.c (working copy) @@ -266,7 +266,7 @@ can_inline_edge_p (struct cgraph_edge *e else if (avail <= AVAIL_OVERWRITABLE) { e->inline_failed = CIF_OVERWRITABLE; - return false; + inlinable = false; } else if (e->call_stmt_cannot_inline_p) {