> On 27 Jun 2024, at 20:06, Richard Biener via Gcc <gcc@gcc.gnu.org> wrote:
>> Am 27.06.2024 um 19:43 schrieb Iain Sandoe <i...@sandoe.co.uk>:
>>> On 27 Jun 2024, at 14:51, Iain Sandoe <i...@sandoe.co.uk> wrote:
>>> 
>>> If I declare a function __attribute__((noipa, optimize (“-O0”))), I was 
>>> kinda expecting that it would not be optimized at all ..
>>> 
>>> however it does not seem to prevent functions called by it from being 
>>> inlined into its body ..
>>> 
>>> am I missing some additional constraint that should be added?
>>> 
>>> (I explicitly want to avoid called functions being inlined into the body, 
>>> but cannot mark _those_ functions as noinline)
>> 
>> Additional:  If I compile the entire code “O0” then all behaves as expected.
>> 
>> The issue seems to be when compiing (say) O2 and a function has a local 
>> optimisation set lower (O0) ..
>> perhaps this is a target problem ..
>> although looking at say tree-ssa-ccp.cc I do not see any gating on the 
>> optimisation level - which I guess suggests once it’s selected in the stack 
>> .. it’s going to run…
>> 
>> any insights would be welcome.
> 
> It might be that we do not honor -O0 in the caller this way during IPA 
> inlining.  I would guess it correctly disables early inlining into it though. 
>  It sounds like a bug to me.

Pilot error — synthesizing function decls sometimes needs to emulate some of 
the parser actions.

It’s not enough to attach the attributes to the decl, in some cases the 
attributes machinery processes them at parse time and adds internal information 
to the decl itself.  That is the case here.

So no bug - at least, I can now build a fn that has no optimisation.

thanks
Iain

Reply via email to