public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/55814] Missed optimization with short-circuit evaluation of always evaluated comparisons/loads Date: Thu, 27 Dec 2012 17:24:00 -0000 [thread overview] Message-ID: <bug-55814-4-fiDh4K3e0W@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55814-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55814 --- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-12-27 17:23:54 UTC --- An even more pronounced test case, where we could sink a lot more stores, which in fact could lead to moving a whole loop: logical function bar(a,b,c) logical, intent(in) :: a, b logical, intent(in), dimension(3) :: c bar = a .and. b .and. any(c) end This is translated by the Fortran FE to bar (logical(kind=4) & restrict a, logical(kind=4) & restrict b, logical(kind=4)[3] * restrict c) { logical(kind=4) __result_bar; { logical(kind=4) test.0; test.0 = 0; { integer(kind=8) S.1; S.1 = 1; while (1) { if (S.1 > 3) goto L.2; if (NON_LVALUE_EXPR <(*c)[S.1 + -1]>) { test.0 = 1; goto L.1; } S.1 = S.1 + 1; } L.2:; } L.1:; __result_bar = (*a && *b) && test.0; } return __result_bar; } which the middle-end then doesn't optimize - there would be no need to evaluate the loop if either a or b were false.
next prev parent reply other threads:[~2012-12-27 17:24 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-12-26 17:45 [Bug middle-end/55814] New: Missed optimization with short-circuit evaluation tkoenig at gcc dot gnu.org 2012-12-26 21:46 ` [Bug middle-end/55814] Missed optimization with short-circuit evaluation of always evaluated comparisons/loads pinskia at gcc dot gnu.org 2012-12-27 17:24 ` tkoenig at gcc dot gnu.org [this message] 2012-12-31 16:26 ` rguenth 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-55814-4-fiDh4K3e0W@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: linkBe 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).