public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "freddie at witherden dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95264] Infinite Loop When Compiling Templated C++ code at -O1 and above
Date: Fri, 22 May 2020 11:49:25 +0000	[thread overview]
Message-ID: <bug-95264-4-tJzjQsCuSE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95264-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Freddie Witherden <freddie at witherden dot org> ---
(In reply to rguenther@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?

  parent reply	other threads:[~2020-05-22 11:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 22:08 [Bug c++/95264] New: " freddie at witherden dot org
2020-05-22  9:14 ` [Bug c++/95264] " rguenth at gcc dot gnu.org
2020-05-22  9:35 ` rguenth at gcc dot gnu.org
2020-05-22  9:44 ` rguenth at gcc dot gnu.org
2020-05-22  9:55 ` rguenth at gcc dot gnu.org
2020-05-22 10:19 ` rguenth at gcc dot gnu.org
2020-05-22 11:13 ` freddie at witherden dot org
2020-05-22 11:34 ` rguenther at suse dot de
2020-05-22 11:49 ` freddie at witherden dot org [this message]
2021-10-02  6:00 ` [Bug ipa/95264] " pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95264-4-tJzjQsCuSE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).