public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/99101] optimization bug with -ffinite-loops
Date: Mon, 15 Feb 2021 10:46:40 +0000	[thread overview]
Message-ID: <bug-99101-4-u40FcbrUUA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99101-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> If there are EH edges, doesn't it fit then the -ffinite-loops description:
> '-ffinite-loops'
>      Assume that a loop with an exit will eventually take the exit and
>      not loop indefinitely.  This allows the compiler to remove loops
>      that otherwise have no side-effects, not considering eventual
>      endless looping as such.
> 
>      This option is enabled by default at '-O2' for C++ with -std=c++11
>      or higher.
> ?  EH is an exit as well...

Note the exit isn't an EH edge (sorry for misleading), it's a conditional
controlled exit to noreturn std::__throw_bad_cast ():

  <bb 5> [local count: 11633210387]:
  comp_md_.at_eof_ = 1;
  _14 = std::basic_ostream<char>::operator<< (&cout, 1);
  _15 = _14->_vptr.basic_ostream;
  _16 = MEM[(long int *)_15 + -24B];
  _17 = (sizetype) _16;
  _18 = _14 + _17;
  _23 = MEM[(const struct __ctype_type * *)_18 + 240B];
  if (_23 == 0B)
    goto <bb 6>; [0.04%]
  else
    goto <bb 7>; [99.96%]

  <bb 6> [local count: 4653337]:
  std::__throw_bad_cast ();

and handling this call first in the post-dom DFS when walking not
reverse reachable blocks makes control dependence behave wrong (or
CD-DCEs expectation is).

Note _not_ treating EH or abnormals as exit makes us more conservative
(we consider the loop to be _not_ finite then).

Again, sorry for misleading.

  parent reply	other threads:[~2021-02-15 10:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15  8:55 [Bug c++/99101] New: " 251078896 at qq dot com
2021-02-15  9:43 ` [Bug tree-optimization/99101] " rguenth at gcc dot gnu.org
2021-02-15 10:17 ` rguenth at gcc dot gnu.org
2021-02-15 10:25 ` 251078896 at qq dot com
2021-02-15 10:29 ` jakub at gcc dot gnu.org
2021-02-15 10:38 ` rguenth at gcc dot gnu.org
2021-02-15 10:46 ` rguenth at gcc dot gnu.org [this message]
2021-02-15 13:08 ` rguenth at gcc dot gnu.org
2021-02-24 14:00 ` rguenth at gcc dot gnu.org
2021-02-24 14:20 ` rguenth at gcc dot gnu.org
2021-02-24 14:41 ` rguenth at gcc dot gnu.org
2021-02-24 14:45 ` rguenth at gcc dot gnu.org
2021-02-24 15:09 ` rguenth at gcc dot gnu.org
2021-02-25 10:18 ` rguenth at gcc dot gnu.org
2021-02-25 11:34 ` rguenth at gcc dot gnu.org
2021-02-25 12:09 ` rguenth at gcc dot gnu.org
2021-02-25 12:40 ` rguenth at gcc dot gnu.org
2021-02-25 13:31 ` matz at gcc dot gnu.org
2021-02-25 18:29 ` matz at gcc dot gnu.org
2021-02-25 18:34 ` matz at gcc dot gnu.org
2021-02-26  9:38 ` rguenth at gcc dot gnu.org
2021-03-03 12:16 ` rguenth at gcc dot gnu.org
2021-03-03 14:00 ` matz at gcc dot gnu.org
2021-03-03 14:37 ` rguenth at gcc dot gnu.org
2021-03-03 19:52 ` hubicka 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-99101-4-u40FcbrUUA@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).