[cfe-dev] how to run no optimization except inlining at O3 level when generating IR

林政宗 via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 22 04:54:55 PDT 2020


Hi,
If I put the pragma outside the function, optnone will override the always_inline attribute.
And if always_inline doesn't function, the result of this funciton will be wrong for some reason.
I hope that clang can inline this function but does no optimizaton on function body. 
Is there a solution to achieve this?


Thanks! 













At 2020-09-21 14:30:40, "陈志伟" <chenzhiwei03 at kuaishou.com> wrote:



__attribute__((always_inline)) void conv2d_reduce() {
#pragma clang optimize off
/*     functionbody      */
#pragma clang optimize on
}


Put the pragma directive outside the function.


The optnone attribute is for functions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200922/5db0dbcb/attachment.html>


More information about the cfe-dev mailing list