From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <rguenther@suse.de>
Cc: Jakub Jelinek <jakub@redhat.com>,
gcc-patches@gcc.gnu.org,
"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [PATCH][RFC] c/94392 - only enable -ffinite-loops for C++
Date: Wed, 1 Apr 2020 17:56:32 +0200 [thread overview]
Message-ID: <20200401155632.GB53791@kam.mff.cuni.cz> (raw)
In-Reply-To: <nycvar.YFH.7.76.2004011549340.830@zhemvz.fhfr.qr>
> On Wed, 1 Apr 2020, Jakub Jelinek wrote:
>
> > On Wed, Apr 01, 2020 at 03:36:30PM +0200, Richard Biener wrote:
> > > @@ -512,7 +512,10 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
> > > /* When devirtualization is disabled for callee, it is not safe
> > > to inline it as we possibly mangled the type info.
> > > Allow early inlining of always inlines. */
> > > - || (!early && check_maybe_down (flag_devirtualize)))
> > > + || (!early && check_maybe_down (flag_devirtualize))
> > > + /* It's not safe to inline a function where loops maybe
> > > + infinite into a function where we assume the reverse. */
> > > + || check_maybe_down (flag_finite_loops))
> > > {
> > > e->inline_failed = CIF_OPTIMIZATION_MISMATCH;
> > > inlinable = false;
> >
> > Couldn't the above care only if the function has any loops?
> > Otherwise, won't it prevent cross-language LTO inlining too much?
> > Or instead of disabling inlining arrange for a safe flag_finite_loops value
> > for the resulting function (set some flag in cfun of the function that would
> > be considered together with flag_finite_loops (so that we don't have to
> > create further OPTIMIZATION_NODEs) and disable finite loops opts if we've
> > inlined !flag_finite_loops function into flag_finite_loops one)?
>
> I guess I can split out this hunk from the patch - it's a separate
> issue affecting also C++ with mixed option CUs. Yes, ideally we'd
> simply initialize loop->finite_p from flag_finite_loops at CFG
> construction time and then only ever check the flag on the loop
> structure. That would leave us with infinite loops for loops
> we only discover later though. It also opens up the possibility
> of a per-loop #pragma.
We do want to preserve cross-module inlining between C and C++, so we
really should go with marking the loops pre-inline about finiteness and
try to preserve the info, otherwise we are going to lose quite some
optimizations.
Honza
>
> Richard.
next prev parent reply other threads:[~2020-04-01 15:56 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 4:17 [PATCH] Remove empty loop with assumed finiteness (PR tree-optimization/89713) Feng Xue OS
2019-05-17 16:47 ` Jeff Law
2019-05-17 18:50 ` Richard Biener
2019-05-18 14:00 ` Marc Glisse
2019-05-20 7:50 ` Richard Biener
2019-05-20 8:27 ` Feng Xue OS
2019-05-20 9:19 ` Richard Biener
2019-05-20 9:48 ` Feng Xue OS
2019-05-20 11:54 ` Richard Biener
2019-05-20 14:00 ` Feng Xue OS
2019-05-20 14:04 ` Richard Biener
2019-05-20 14:51 ` Feng Xue OS
2019-05-21 10:12 ` Richard Biener
2019-05-21 14:24 ` Richard Biener
2019-05-22 13:44 ` Michael Matz
2019-05-24 16:02 ` [PATCH V3] " Feng Xue OS
2019-05-24 9:15 ` [PATCH V2] " Feng Xue OS
2019-05-29 11:16 ` Richard Biener
2019-06-04 6:49 ` [PATCH V4] " Feng Xue OS
2019-06-04 8:24 ` Marc Glisse
2019-06-04 15:16 ` [PATCH V5] " Feng Xue OS
2019-06-04 15:24 ` [PATCH V6] " Feng Xue OS
2019-06-05 11:05 ` Richard Biener
2019-06-06 10:00 ` [PATCH V7] " Feng Xue OS
2019-06-11 2:40 ` [PATCH V8] " Feng Xue OS
2019-06-12 9:43 ` Richard Biener
2019-06-15 12:05 ` [committed][nvptx, libgomp] Update pr85381-{2,4}.c test-cases Tom de Vries
2019-05-20 13:04 ` [PATCH] Remove empty loop with assumed finiteness (PR tree-optimization/89713) Marc Glisse
2019-05-20 13:26 ` Richard Biener
2019-05-20 14:49 ` Michael Matz
2019-05-21 8:06 ` Marc Glisse
2020-04-01 13:36 ` [PATCH][RFC] c/94392 - only enable -ffinite-loops for C++ Richard Biener
2020-04-01 13:47 ` Jakub Jelinek
2020-04-01 13:52 ` Richard Biener
2020-04-01 15:56 ` Jan Hubicka [this message]
2020-04-01 16:59 ` Richard Biener
2020-04-01 19:15 ` Jason Merrill
2020-04-02 9:12 ` Richard Biener
2020-04-02 9:17 ` Jakub Jelinek
2020-04-02 9:41 ` Richard Biener
2020-04-03 8:29 ` Revert "[nvptx, libgomp] Update pr85381-{2, 4}.c test-cases" [PR89713, PR94392] (was: [PATCH][RFC] c/94392 - only enable -ffinite-loops for C++) Thomas Schwinge
2020-04-03 9:36 ` Revert "[nvptx, libgomp] Update pr85381-{2,4}.c " Richard Biener
2020-04-03 10:34 ` Jakub Jelinek
2020-10-30 14:09 ` Revert "[nvptx, libgomp] Update pr85381-{2, 4}.c " Thomas Schwinge
2020-10-30 14:16 ` Revert "[nvptx, libgomp] Update pr85381-{2,4}.c " Jakub Jelinek
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=20200401155632.GB53791@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=rguenther@suse.de \
/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).