[attribute] does it make sense to inline a function with __attribute__((noipa))

int __attribute__((noipa)) dummy (real_t sum) {
    return 0;

real_t s311(struct args_t * func_args)
    real_t sum = (real_t)0.;
    for (int i = 0; i < LEN_1D; i++) {
        sum += a[i];

    dummy (sum);
    return 0.0;

The callee function dummy has a attribute((noipa)), the gcc will prevent the inline, and clang inline it, so they have different behaviors, which one is right ?

I don’t think Clang supports noipa (there’s a warning about it too) so that’s probably what you’re seeing.

Clang does have the noinline attribute, though other optimizations are still allowed which can make the end result look like an inlining event happened. So be careful interpreting the results of that one.


There was some discussion (Revisiting/refining the definition of optnone with interprocedural transformations - #2 by LebedevRI ) and proposal (⚙ D101011 [Attr] Add "noipa" function attribute ) to add this, but I stalled out on the work when it came to some implementation details (should noipa be implemented via “interposable”)