<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="margin: 0;">Hi,</div><div style="margin: 0;">If I put the pragma outside the function, optnone will override the always_inline attribute.</div><div style="margin: 0;">And if always_inline doesn't function, the result of this funciton will be wrong for some reason.</div><div style="margin: 0;">I hope that clang can inline this function but does no optimizaton on function body. </div><div style="margin: 0;">Is there a solution to achieve this?</div><div style="margin: 0;"><br></div><div style="margin: 0;">Thanks! </div><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><p style="margin: 0;"><br></p><p>At 2020-09-21 14:30:40, "³Â־ΰ" <chenzhiwei03@kuaishou.com> wrote:</p><blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">




<br class="">
<div>
<blockquote type="cite" class="">
<div class=""><span style="text-align: justify; font-family: Arial; font-size: 14px;" class="">__attribute__((always_inline)) void conv2d_reduce() {</span></div>
<div class="">
<div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class="">
<div style="text-align: justify; margin: 0px;" class="">#pragma clang <span class="typoRed" evid="1600586060715.2131" id="1600586060715.2131">
optimize</span> off</div>
<div style="text-align: justify; margin: 0px;" class=""><span class="typoRed" evid="1600586060715.1553" id="1600586060715.1553">/*     function</span>
<span class="typoRed" evid="1600586060715.6455" id="1600586060715.6455">body      */</span></div>
<div style="text-align: justify; margin: 0px;" class="">#pragma clang <span class="typoRed" evid="1600586060715.4492" id="1600586060715.4492">
optimize</span> on</div>
<div style="text-align: justify; margin: 0px;" class="">}</div>
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">Put the pragma directive outside the function.</div>
<div class=""><br class="">
</div>
<div class="">The optnone attribute is for functions.</div>


</blockquote></div><br><br><span title="neteasefooter"><p> </p></span>