https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95264

--- Comment #8 from Freddie Witherden <freddie at witherden dot org> ---
(In reply to rguent...@suse.de from comment #7)
> 
> Instead of [[gnu::flatten]] you could use the 
> __attribute__((always_inline)) attribute on the foo function definition
> if you didn't simplify the outline above too much to make that
> infeasible.  IIRC we do not have sth like
> 
>   [[gnu::inline]] foo(i, ...);
> 
> to force inlining of a specific call, nor [[gnu::noinline]] foo(i, ...);
> both which seem useful.  Not sure if the C++ syntax would support
> such placement of an attribute of course.

So this is exactly what we had in the pre-flatten version of the code:

https://github.com/PyFR/Polyquad/commit/f24366c059d2d693222985cdd9333238bd909ad3

The issue was while GCC would inline the annotated functions it would go no
further.  As such, if I recall correctly, all of the constructor calls to the
relatively simple Eigen vector types were no longer inlined.  Thus a line of
code which should translate into a few register-to-memory mov instructions
results in a  a constructor call, an assignment call, and some cleanup.  Since
I could not add the force inline attribute to the library types I went in
search of an alternative.

For the T = bfloat eval_orthob instance is the "if
(std::is_fundamental<T>::value)" considered before the body is inlined?

Reply via email to