how to run no optimization except inlining at O3 level when generating IR

Hi, there,
I met a problem when compiling C source files into IR.
The C source files are compiled at O3 optimization level by clang into IR. There is a functon that I hope to always inline. So I add an always_inline attribute to the function.
But except inlining I hope to run no optimization on it for performance reason, because it has been tuned at its best. I don’t want clang to optimize it except inlining it.
I have tried optnone attribute. But it is incompatible with always_inline.
I have also tried to add something like this.

attribute((always_inline)) void conv2d_reduce() {

#pragma clang optimize off
/* function body */
#pragma clang optimize on
}

Put the pragma directive outside the function.

The optnone attribute is for functions.

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!