[cfe-dev] always_inline with -fno-inline

Greg Fitzgerald gregf at codeaurora.org
Fri Jun 8 11:25:36 PDT 2012



Thanks for the quick reply.  I cannot reproduce the issue in trunk or the 3.1 release - false alarm.





From: Chandler Carruth [mailto:chandlerc at google.com] 
Sent: Thursday, June 07, 2012 5:55 PM
To: Greg Fitzgerald
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] always_inline with -fno-inline


On Thu, Jun 7, 2012 at 5:39 PM, Greg Fitzgerald <gregf at codeaurora.org> wrote:



When clang is invoked with the ‘-fno-inline’ flag and the C function is prefixed by ‘__attribute__((always_inline))’, clang does not inline the function whereas GCC does.  GCC’s behavior seems more intuitive to me - that the file-level annotation should override the command-line flag.  Do you agree?  Can we make clang match gcc?

Yes, I generally agree with GCC's interpretation here. Care to write a patch implementing this? I'm happy to review it.


For reference, the 'always_inline' attribute often has a semantic contract -- failing to inline it can produce wrong code, not just slow code, so it should trump almost everything else.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120608/e36742ee/attachment.html>

More information about the cfe-dev mailing list