From patchwork Wed Mar 11 15:38:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yvan Roux X-Patchwork-Id: 45682 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 44443214BF for ; Wed, 11 Mar 2015 15:38:29 +0000 (UTC) Received: by wggy19 with SMTP id y19sf7239236wgg.2 for ; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-original-sender :x-original-authentication-results; bh=hc1bWua/zw4UXS0s1qygRRGG/nQfgjz+QMbXDXjWfJ0=; b=gcXXdyfTnthfuvaZmaui1z/eKkFeE4rx0KAMnLvkqqMJUMY+0EepC3ts+zKg5sE/aV ZXpg+wsQ2VBONOW4+uBvvYl1qCWCPNgYbcNSWGxM+asC+Mzzuer0DCLJpKMQqspXHwVP seyoXYfFc5R9OEiYajI/ddrkyYjw1fsqR0DiiYgPxkvxk2SNeLZtYO8aOI3v6tS0XmhA JZr8oA5Nc/W/+TSfwbL865YWtVAYt69U++D2+hSdCBpgr+vnkP4jFxysr+H87A6bppMP vP7izDGhTCvA1c/lBXe4UIvvtEMvzCf14kdAZflevL/KMjBCRIF310j3Hi4ZUPMbdMHf ajXw== X-Gm-Message-State: ALoCoQm7b7hrDezcK9BmYxxJEO6RtXommBe6geIe///qn2FWP5sTW4Vmx9ZTUkeSdSLbhfTU660L X-Received: by 10.194.201.10 with SMTP id jw10mr5606915wjc.3.1426088308580; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.68 with SMTP id y4ls181949lay.12.gmail; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) X-Received: by 10.152.181.197 with SMTP id dy5mr35464803lac.57.1426088308340; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com. [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id zl5si2628011lbb.15.2015.03.11.08.38.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 08:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by labge10 with SMTP id ge10so9639047lab.7 for ; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) X-Received: by 10.112.147.229 with SMTP id tn5mr1546170lbb.106.1426088308221; Wed, 11 Mar 2015 08:38:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2856815lbj; Wed, 11 Mar 2015 08:38:26 -0700 (PDT) X-Received: by 10.66.63.106 with SMTP id f10mr79760114pas.0.1426088305817; Wed, 11 Mar 2015 08:38:25 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ey5si7631794pab.172.2015.03.11.08.38.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 08:38:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-393393-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 94074 invoked by alias); 11 Mar 2015 15:38:11 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 94062 invoked by uid 89); 11 Mar 2015 15:38:10 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f181.google.com Received: from mail-ob0-f181.google.com (HELO mail-ob0-f181.google.com) (209.85.214.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 11 Mar 2015 15:38:08 +0000 Received: by obcuz6 with SMTP id uz6so9647191obc.7 for ; Wed, 11 Mar 2015 08:38:06 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.219.215 with SMTP id s206mr28543602oig.114.1426088286225; Wed, 11 Mar 2015 08:38:06 -0700 (PDT) Received: by 10.202.221.214 with HTTP; Wed, 11 Mar 2015 08:38:06 -0700 (PDT) In-Reply-To: References: <20150206202331.GO1746@tucnak.redhat.com> <20150206203709.GA22441@kam.mff.cuni.cz> <20150310181808.GC54464@kam.mff.cuni.cz> Date: Wed, 11 Mar 2015 16:38:06 +0100 Message-ID: Subject: Re: [PATCH] Fix thunk expansion (PR ipa/64896) From: Yvan Roux To: Jan Hubicka Cc: Jakub Jelinek , Richard Biener , "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes X-Original-Sender: yvan.roux@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, >>> PR ipa/65236 >>> * cgraphunit.c (cgraph_node::expand_thunk): Enable return slot >>> opt. > > This bugfix adds ipa-icf-6.C test which failed on 4.9 branch as > ipa-icf is not backported on that branch. Is the bugfix still > relevant and we can dropped the testcase ? > >>> PR ipa/64813 >>> * cgraphunit.c (cgraph_node::expand_thunk): Do not create >>> a return value for call to a function that is noreturn. >>> >>> PR ipa/63595 >>> * cgraphunit.c (cgraph_node::expand_thunk): DECL_BY_REFERENCE >>> is correctly handled for thunks created by IPA ICF. >>> >>> PR ipa/63587 >>> * cgraphunit.c (cgraph_node::expand_thunk): Only VAR_DECLs are put >>> to local declarations. >>> * function.c (add_local_decl): Implementation moved from header >>> file, assert introduced for tree type. >>> * function.h: Likewise. Here is the two patches that backport PR ipa/63587 and PR ipa/64813 fixes in 4.9 branch. The 2 others introduce test cases that check ipa-icf pass dumps, so I'm not sure if the code has to be backported. bootstrapped/regtested on x86_64 and cross-compiled/regtested on aarch64-linux-gnu arm-linux-gnueabihf armeb-linux-gnueabihf i686-linux-gnu Ok for 4.9 ? Thanks Yvan ----- PR 63587 ----- gcc/ 2015-03-11 Yvan Roux Backport from trunk r216841. 2014-10-29 Martin Liska PR ipa/63587 * cgraphunit.c (cgraph_node::expand_thunk): Only VAR_DECLs are put to local declarations. * function.c (add_local_decl): Implementation moved from header file, assert introduced for tree type. * function.h: Likewise. gcc/testsuite/ 2015-03-11 Yvan Roux Backport from trunk r216841. 2014-10-29 Martin Liska PR ipa/63587 * g++.dg/ipa/pr63587-1.C: New test. * g++.dg/ipa/pr63587-2.C: New test. ----- PR 64813 ----- 2015-03-11 Yvan Roux Backport from trunk r220616. 2015-02-11 Martin Liska PR ipa/64813 * cgraphunit.c (cgraph_node::expand_thunk): Do not create a return value for call to a function that is noreturn. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 130fc0d..2fcb84c 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1532,6 +1532,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks) gimple call; gimple ret; + bool alias_is_noreturn = TREE_THIS_VOLATILE (alias); if (in_lto_p) cgraph_get_body (node); @@ -1566,7 +1567,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks) bsi = gsi_start_bb (bb); /* Build call to the function being thunked. */ - if (!VOID_TYPE_P (restype)) + if (!VOID_TYPE_P (restype) && !alias_is_noreturn) { if (DECL_BY_REFERENCE (resdecl)) restmp = gimple_fold_indirect_ref (resdecl); @@ -1610,14 +1611,14 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks) call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs); node->callees->call_stmt = call; gimple_call_set_from_thunk (call, true); - if (restmp) + if (restmp && !alias_is_noreturn) { gimple_call_set_lhs (call, restmp); gcc_assert (useless_type_conversion_p (TREE_TYPE (restmp), TREE_TYPE (TREE_TYPE (alias)))); } gsi_insert_after (&bsi, call, GSI_NEW_STMT); - if (!(gimple_call_flags (call) & ECF_NORETURN)) + if (!alias_is_noreturn) { if (restmp && !this_adjusting && (fixed_offset || virtual_offset)) -- 1.9.1