public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104579] vectorizer failed to reduce max & index search together Date: Thu, 17 Feb 2022 07:07:51 +0000 [thread overview] Message-ID: <bug-104579-4-QeExbbinEO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104579-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104579 --- Comment #1 from Hongtao.liu <crazylht at gmail dot com> --- ------------cut ------------ /* Function vect_is_simple_reduction (1) Detect a cross-iteration def-use cycle that represents a simple reduction computation. We look for the following pattern: loop_header: a1 = phi < a0, a2 > a3 = ... a2 = operation (a3, a1) or a3 = ... loop_header: a1 = phi < a0, a2 > a2 = operation (a3, a1) such that: 1. operation is commutative and associative and it is safe to change the order of the computation 2. no uses for a2 in the loop (a2 is used out of the loop) 3. no uses of a1 in the loop besides the reduction operation ---------end------------------ ----dump vect------- <bb 3> [local count: 955630225]: # maxInt_19 = PHI <maxInt_7(8), maxInt_14(18)> # maxIndex_20 = PHI <maxIndex_9(8), 0(18)> # i_24 = PHI <i_18(8), 1(18)> _1 = (long unsigned int) i_24; _2 = _1 * 4; _3 = src_13(D) + _2; _4 = *_3; maxInt_7 = MAX_EXPR <_4, maxInt_19>; ------ reduction operation maxIndex_9 = _4 <= maxInt_19 ? maxIndex_20 : i_24; --- another use here. i_18 = i_24 + 1; if (n_15(D) > i_18) ----dump end--------- For the case in the PR, there's 2 uses for a1(maxInt_19), one in reduction operation(MAX_EXPR <_4, maxInt_19>), another in 4 <= maxInt_19 ? maxIndex_20 : i_24), and it failed.
next prev parent reply other threads:[~2022-02-17 7:07 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-17 7:02 [Bug tree-optimization/104579] New: " crazylht at gmail dot com 2022-02-17 7:07 ` crazylht at gmail dot com [this message] 2022-02-17 7:35 ` [Bug tree-optimization/104579] " crazylht at gmail dot com 2022-02-17 8:14 ` crazylht at gmail dot com 2022-02-17 10:12 ` rguenth at gcc dot gnu.org 2022-02-17 11:15 ` crazylht at gmail dot com 2022-02-18 0:48 ` 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-104579-4-QeExbbinEO@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).