From patchwork Thu Jun 19 08:39:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 361816 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 3B4BD14008B for ; Thu, 19 Jun 2014 18:39:39 +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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=J7qizYbj7wBVPny0W 87FTJSla4bDwtycPyN1HGkgtNMJJZnWwKviXVvfG0K0N5oVJ23sF9biOH55JY25A 7KYbTxXl2sljz9GYn3dpZx2oONq8Uoad+HBcB2in1YsCL7Y3C5AMZ85DH6eB7gLA Vq3DWcf3LTfBqkcGlIoekFeyvo= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=tsFQg2HtFlB19jiC5v7najz kyJg=; b=Efm85sea2Drp3degXveanhwBBiEYIl2oTI5TqHxWtOT9DDH3sk3wb3P YqFk5ierIaJpQgEVrJw79e0jinHoE/pbFSR9odt3Y5LLRDPvZJFHLWASbiKVkF48 yRucYvYccfnXJacwMM3NQa52p6+Ry/s0DX+Rmwz2KErmWdOTTbVo= Received: (qmail 8015 invoked by alias); 19 Jun 2014 08:39:32 -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 8001 invoked by uid 89); 19 Jun 2014 08:39:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Jun 2014 08:39:30 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WxXsS-00042K-Bi from Tom_deVries@mentor.com ; Thu, 19 Jun 2014 01:39:24 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 19 Jun 2014 01:39:24 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Thu, 19 Jun 2014 09:39:21 +0100 Message-ID: <53A2A1B7.1060209@mentor.com> Date: Thu, 19 Jun 2014 10:39:19 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Richard Henderson CC: Richard Earnshaw , GCC Patches Subject: Re: [PATCH, AARCH64] Enable fuse-caller-save for AARCH64 References: <538AF9C7.7040408@mentor.com> <53A25E9D.1050005@redhat.com> In-Reply-To: <53A25E9D.1050005@redhat.com> On 19-06-14 05:53, Richard Henderson wrote: > Do we in fact make sure this isn't an ifunc resolver? I don't immediately see > how those get wired up in the cgraph... Richard, using the patch below I changed the gcc/testsuite/gcc.target/i386/fuse-caller-save.c testcase to use an ifunc resolver, and observed that the fuse-caller-save optimization didn't work. The reason the optimization doesn't work in this case is that default_binds_local_p_1 checks the ifunc attribute: ... /* Weakrefs may not bind locally, even though the weakref itself is always static and therefore local. Similarly, the resolver for ifunc functions might resolve to a non-local function. FIXME: We can resolve the weakref case more curefuly by looking at the weakref alias. */ else if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp)) || (TREE_CODE (exp) == FUNCTION_DECL && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp)))) local_p = false; ... The default_binds_local_p_1 function is used via this path in the optimization: get_call_reg_set_usage -> get_call_cgraph_rtl_info -> decl_binds_to_current_def_p -> default_binds_local_p -> default_binds_local_p_1 . Thanks, - Tom diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c index 4ec4995..012dc12 100644 --- a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c @@ -5,11 +5,18 @@ /* Testing -fuse-caller-save optimization option. */ static int __attribute__((noinline)) -bar (int x) +my_bar (int x) { return x + 3; } +static void (*resolve_bar (void)) (void) +{ + return (void*) my_bar; +} + +static int __attribute__((noinline)) __attribute__((ifunc ("resolve_bar"))) bar (int x); + int __attribute__((noinline)) foo (int y) { -- 1.9.1