From patchwork Mon Jun 17 17:49:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 252023 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 4E03F2C0085 for ; Tue, 18 Jun 2013 03:49:57 +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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=EDlCDQrL7t10pIK7bx pu1NG0b+6Ok2AiDbIvu/2KLYxjDy7Kae3F/cw/8vi3ojUV0B+4//y447Nl7eK9JZ EIgoWzQYMD9la3k+dCbUZFM5xOCo6gni0VWnWIu/lGadZcI1J6vwCCiKEAe77noD QCrXOaja4SaK4xLwgWO/X5WHo= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=hxJZP/+lxtf1wvXoDTNFvx0h kH0=; b=Cvgm4Ya5LGtO3a0r+0aHfnTPDJPZED3cQPspzkDCrUxysxENDI0noscQ qDoc05eQ8hPMbr0EtwnkCqrPW9+voqy60K52UPSpaPYMYhTIQ7u+UvXMuRspytol EfgdU5UkAykK3654tOkS4bLjMb+pR08pCBfHubwu8Z88YqJU6e0= Received: (qmail 28048 invoked by alias); 17 Jun 2013 17:49:51 -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 28020 invoked by uid 89); 17 Jun 2013 17:49:46 -0000 X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ee0-f48.google.com (HELO mail-ee0-f48.google.com) (74.125.83.48) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 17 Jun 2013 17:49:44 +0000 Received: by mail-ee0-f48.google.com with SMTP id b47so1982039eek.35 for ; Mon, 17 Jun 2013 10:49:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=jCLSKEceI7Raj00K+IAQPQU42oJwEZgW3rQdMCHdKU4=; b=pTFWcUEz3eBXJRZBS0NqqDfauLH7bSQPTz0IlSpT/VmPTI/BIIERATp6VxyZydZ/xP 22XBE3mSdMD0HWr4yz8eHdFVuj25gStpyhtGUyCLyzoChVgL5XzzyMz0ce9LnwZAXLXR d4TV03BG2n8Sz9Y7c1uheGSL4PzlmTIna3pLIgY0bqkl3t+tLVe09rE/nRcLWSsF1E/j KaEpFIuQ0bUY2B8RDPcxrDQDTpSTuRn9SHN8U7+ERoiBECWwD+/DcuFiWzRfGzStDtPt Bs48QKmCuoWG0x7U3AipMT5/IUFnFCgnjxKqZP/86pxi4d6zsUxyiKAMAULXFL9OeOk+ yG7A== MIME-Version: 1.0 X-Received: by 10.15.49.9 with SMTP id i9mr17884540eew.69.1371491382462; Mon, 17 Jun 2013 10:49:42 -0700 (PDT) Received: by 10.14.141.14 with HTTP; Mon, 17 Jun 2013 10:49:42 -0700 (PDT) In-Reply-To: References: <20130613170751.GA26413@kam.mff.cuni.cz> <20130613171952.GA27483@atrey.karlin.mff.cuni.cz> <20130613194035.GB26413@kam.mff.cuni.cz> Date: Mon, 17 Jun 2013 10:49:42 -0700 Message-ID: Subject: Re: GCC does not support *mmintrin.h with function specific opts From: Sriraman Tallam To: Richard Biener Cc: Jan Hubicka , Xinliang David Li , Jakub Jelinek , GCC Patches , Uros Bizjak , "H.J. Lu" , "Joseph S. Myers" , Diego Novillo X-Gm-Message-State: ALoCoQlI4ZsKeR+OJY3RBp95n0b+jD3ykqsjc2JXJsjh991KxWpwvQqBYgCIscQm9AblbOkzlPvG18G1LI+AhHjoACbEvFdBpcqh2MbQC12hSiDD6J2DXe37z/VGXTNqX+FkyvgZP26ksVl+fTEoTVizmfbeX7N8snHxigL/1u3LcHRMFTO8A/22N8vIlc6F/g54fuqmRDUqpTJDiIFUOTTtuoFXciYOTw== X-Virus-Found: No X-IsSubscribed: yes On Fri, Jun 14, 2013 at 11:08 AM, Sriraman Tallam wrote: > On Fri, Jun 14, 2013 at 1:43 AM, Richard Biener > wrote: >> On Fri, Jun 14, 2013 at 4:52 AM, Sriraman Tallam wrote: >>> On Thu, Jun 13, 2013 at 12:40 PM, Jan Hubicka wrote: >>>>> * tree-inline.c (expand_call_inline): Allow the error to be flagged >>>>> in early inline pass. >>>>> * ipa-inline.c (inline_always_inline_functions): Pretend always_inline >>>>> functions are inlined during failures to flag an error. >>>>> * gcc.target/i386/inline_error.c: New test. >>> >>>> This patch is OK if it passes testing. >>> >>> Two tests gcc.c-torture/compile/pr43791.c and pr44043.c are failing >>> because of always_inline functions being present that cannot be >>> inlined and the compiler is now generating error messages. I will fix >>> them and resend the patch. >> >> Quick look - pr43791.c is not expected to work at -O0, so skip -O0 >> for example by guarding the whole thing with #if __OPTIMIZED__ > 0. >> Similar for pr44043.c. > > Seems like __OPTIMIZED__ is not defined in my config, dont know why. I > see other tests checking for __OPTIMIZED. > > I fixed these two tests by adding a dg-prune-output at the end. Is > that reasonable? I have attached the patch with all tests passing now. I have attached the latest patch with a small error in the previous patch fixed. I will submit this patch if there are no objections. Thanks Sri > > Thanks > Sri > >> >> That we didn't error at -O0 before is a bug. Eventually I was suggesting >> to error if we end up outputting the body of an always_inline function, >> that is, any uses remain (including indirect calls or address-takens which >> is where we do not error right now). >> >> Richard. >> >>> Thanks >>> Sri >>> >>>> Thanks for your patience! >>> >>> >>> >>>> >>>> Honza * tree-inline.c (expand_call_inline): Allow the error to be flagged in early inline pass. * ipa-inline.c (inline_always_inline_functions): Pretend always_inline functions are inlined during failures to flag an error. * gcc.target/i386/inline_error.c: New test. * gcc.c-torture/compile/pr44043.c: Fix test to expect an error. * gcc.c-torture/compile/pr43791.c: Fix test to expect an error. Index: testsuite/gcc.c-torture/compile/pr44043.c =================================================================== --- testsuite/gcc.c-torture/compile/pr44043.c (revision 200034) +++ testsuite/gcc.c-torture/compile/pr44043.c (working copy) @@ -85,3 +85,5 @@ int raw_sendmsg(struct sock *sk, struct msghdr *ms { raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); } + +/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ Index: testsuite/gcc.c-torture/compile/pr43791.c =================================================================== --- testsuite/gcc.c-torture/compile/pr43791.c (revision 200034) +++ testsuite/gcc.c-torture/compile/pr43791.c (working copy) @@ -1,3 +1,4 @@ + int owner(); int clear(); @@ -18,4 +19,4 @@ void fasttrylock(void (*slowfn)()) { void trylock(void) { fasttrylock(slowtrylock); } - +/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ Index: testsuite/gcc.target/i386/inline_error.c =================================================================== --- testsuite/gcc.target/i386/inline_error.c (revision 0) +++ testsuite/gcc.target/i386/inline_error.c (revision 0) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -mno-popcnt" } */ + +inline int __attribute__ ((__gnu_inline__, __always_inline__, target("popcnt"))) +foo () /* { dg-error "inlining failed in call to always_inline .* target specific option mismatch" } */ +{ + return 0; +} + +int bar() +{ + return foo (); /* { dg-error "called from here" } */ +} Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 200034) +++ ipa-inline.c (working copy) @@ -1911,7 +1911,15 @@ inline_always_inline_functions (struct cgraph_node } if (!can_early_inline_edge_p (e)) - continue; + { + /* Set inlined to true if the callee is marked "always_inline" but + is not inlinable. This will allow flagging an error later in + expand_call_inline in tree-inline.c. */ + if (lookup_attribute ("always_inline", + DECL_ATTRIBUTES (callee->symbol.decl)) != NULL) + inlined = true; + continue; + } if (dump_file) fprintf (dump_file, " Inlining %s into %s (always_inline).\n", Index: tree-inline.c =================================================================== --- tree-inline.c (revision 200034) +++ tree-inline.c (working copy) @@ -3905,8 +3905,6 @@ expand_call_inline (basic_block bb, gimple stmt, c for inlining, but we can't do that because frontends overwrite the body. */ && !cg_edge->callee->local.redefined_extern_inline - /* Avoid warnings during early inline pass. */ - && cgraph_global_info_ready /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) {