From patchwork Thu Jun 13 18:33:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 251147 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 3101B2C009A for ; Fri, 14 Jun 2013 04:33:26 +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=YcjfsqA7SAs370Jh0x U8hjyQSeUh/kILMOZHUZxe3xGWCLRAtOkS1+K9KuJ7W3IOB8POgDmpTAAbLwrqoJ TqHsDovdaLg5z7Mt+l0+YlVpCluYI0lUzLaHjg/iIJWyItrgJrJLcnzCcSHuBTvM vWLnaFfWpIAmjxBuOOuIlwi+E= 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=/NP43jLIkt7dnG+KHTgNUHwC liE=; b=KwMLXxss9d10qId9Iv9CwWR0YqEIHVtnIo6Kh6fT7NtA9dUKaZHBqOMz B70p6Z2YGvUpgBPpmWHopd6bxFyl62YZX7VLcrN3/m9GdNAMAvW2tCmYDpBQPrbx SFi0VqKul9fzZjkUMJBzEzStj00Ky7WmmsQ5PbXkL63HyCijdg8= Received: (qmail 10600 invoked by alias); 13 Jun 2013 18:33:16 -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 10589 invoked by uid 89); 13 Jun 2013 18:33:16 -0000 X-Spam-SWARE-Status: No, score=-4.1 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-ie0-f172.google.com (HELO mail-ie0-f172.google.com) (209.85.223.172) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 13 Jun 2013 18:33:13 +0000 Received: by mail-ie0-f172.google.com with SMTP id 16so5329054iea.3 for ; Thu, 13 Jun 2013 11:33:12 -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=sbtihct8FC6gyraN3AELGxkvvja8Kgm1ATNKab0qKmk=; b=k4H+pGCJ2hyp8LuSXJPK7cUA16k2/tfrM4CddleFP6J6BnJgX1Ti/DNJ/mOzSGWYFm xeGKSYMKDMrSOdVELVjrh5eElvXbhokzkOVrQvcSLAOb+LvKOPp70yHcau5m7kqwc8o6 LhqSEHOjvaxgDFl/AcSu4DCspFxPuMwwMdkGMzTQmoJ8sZIyryFFegclD8Q5gYEaI44b 3IY0skN+9RCKWul38ed1Mho7EvEbmVPybDBW6ikCzxKa+ccbT2IjDQe5lcuFhn9FdCAZ s+E53aQ4nvv+7uSMiVyczFkg984zpJeZQoieYZaKtAgs8ytsaK7XBtKcBY9KiCxFrLpp dvXg== MIME-Version: 1.0 X-Received: by 10.50.107.106 with SMTP id hb10mr6319138igb.25.1371148392121; Thu, 13 Jun 2013 11:33:12 -0700 (PDT) Received: by 10.231.63.2 with HTTP; Thu, 13 Jun 2013 11:33:12 -0700 (PDT) In-Reply-To: <20130613171952.GA27483@atrey.karlin.mff.cuni.cz> References: <20130518062136.GF1377@tucnak.redhat.com> <20130613170751.GA26413@kam.mff.cuni.cz> <20130613171952.GA27483@atrey.karlin.mff.cuni.cz> Date: Thu, 13 Jun 2013 11:33:12 -0700 Message-ID: Subject: Re: GCC does not support *mmintrin.h with function specific opts From: Sriraman Tallam To: Jan Hubicka Cc: Xinliang David Li , Jakub Jelinek , GCC Patches , Uros Bizjak , "H.J. Lu" , "Joseph S. Myers" , Diego Novillo X-Gm-Message-State: ALoCoQlputM89TlqM3gFN4q7wMRwdYfs1HgUbp3TlfybFxoRDFG8frbrT+UQWZ4w2Z3SWsR12LaBXHgtEsif9VsaA0G6+xXkapycM4x8rBwMJcj7S9YX74quzODuErPQ2L3csyv7uX6eLifhltp/FJ86d6WdW8SIBSGQGImF0lfbHE7ImlpqTboHPQyAb8RBzUni6VlOjUCSs6VLpLRoOc+7pdSxp9MuDg== X-Virus-Found: No X-IsSubscribed: yes On Thu, Jun 13, 2013 at 10:19 AM, Jan Hubicka wrote: >> On Thu, Jun 13, 2013 at 10:07 AM, Jan Hubicka wrote: >> >> Can you create a helper function to flag the error and perhaps also >> >> put that check inside can_inline_edge_p ? >> >> >> >> David >> >> >> >> >> >> On Wed, Jun 12, 2013 at 6:00 PM, Sriraman Tallam wrote: >> >> > Hi Honza, >> >> > >> >> > I have isolated the ipa-inline.c part into a separate patch with a >> >> > test and attached it here. The patch is simple. Could you please take >> >> > a look? >> >> > >> >> > * ipa-inline.c (can_early_inline_edge_p): Flag an error when >> >> > the function that cannot be inlined is target specific. >> >> > * gcc.target/i386/inline_error.c: New test. >> > >> > Sorry for taking ages to look at the patch, I was too hooked into other problems. >> > I also think can_early_inline_edge_p should not produce diagnostic - it is supposed >> > to be predicate. >> > >> > So your problem is that the hard worker in tree-inline is not called at -O0 >> > and thus errors are not output? I would suggest arranging inline_always_inline_functions >> > to return true even if inlining failed and thus making inline_calls to be called. >> >> Thanks Honza! Yes, that is the problem. Should I just make it return >> true for these special conditions (TARGET_MISMATCH + gnu_inline + >> always_inline + ...)? > > Can't it just return true if there is any alwaysinline call? I think if inline fails, > we always want to error, right? Ok, patch attached that does this. Please let me know what you think. Thanks Sri > > 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. 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)) { 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: 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" } */ +}