public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63168] New: not vectorized: latch block not empty Date: Thu, 04 Sep 2014 13:48:00 -0000 [thread overview] Message-ID: <bug-63168-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63168 Bug ID: 63168 Summary: not vectorized: latch block not empty Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Consider the 2 codes below. int mymax1(int *it, int *end) { int max = *it++; for (; it != end; it++) if (*it > max) max = *it; return max; } int mymax2(int *it, int *end) { int max = *it; while (++it != end) if (*it > max) max = *it; return max; } Compiled with g++ -Ofast, the first one is vectorized but not the second one. It gives up immediately because of "latch block not empty". That seems rather fragile :-( <bb 3>: max_8 = *it_6; max_10 = MAX_EXPR <max_2, max_8>; <bb 4>: # it_1 = PHI <it_6(3), it_4(D)(2)> # max_2 = PHI <max_10(3), max_5(2)> it_6 = it_1 + 4; if (it_6 != end_7(D)) goto <bb 3>; else goto <bb 5>; There are several related bugs (like PR 33447), feel free to mark as a dup if you can identify one for sure. (code taken from http://stackoverflow.com/q/25622109/1918193 apparently there may be other issues with what gcc produces)
next reply other threads:[~2014-09-04 13:48 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-04 13:48 glisse at gcc dot gnu.org [this message] 2014-09-04 14:18 ` [Bug tree-optimization/63168] loop header copying fails - " rguenth at gcc dot gnu.org 2014-10-15 14:59 ` rguenth at gcc dot gnu.org 2014-10-16 8:35 ` rguenth at gcc dot gnu.org 2014-10-16 10:14 ` rguenth at gcc dot gnu.org 2014-10-16 10:14 ` 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-63168-4@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).