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/113091] Over-estimate SLP vector-to-scalar cost for non-live pattern statement Date: Wed, 20 Dec 2023 13:09:34 +0000 [thread overview] Message-ID: <bug-113091-4-6b5zddNv5e@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113091-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113091 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- It's the logic FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info) { if (svisited.contains (stmt_info)) continue; stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info); if (STMT_VINFO_IN_PATTERN_P (orig_stmt_info) && STMT_VINFO_RELATED_STMT (orig_stmt_info) != stmt_info) /* Only the pattern root stmt computes the original scalar value. */ continue; bool mark_visited = true; gimple *orig_stmt = orig_stmt_info->stmt; ssa_op_iter op_iter; def_operand_p def_p; FOR_EACH_PHI_OR_STMT_DEF (def_p, orig_stmt, op_iter, SSA_OP_DEF) { imm_use_iterator use_iter; gimple *use_stmt; stmt_vec_info use_stmt_info; FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, DEF_FROM_PTR (def_p)) if (!is_gimple_debug (use_stmt)) { use_stmt_info = bb_vinfo->lookup_stmt (use_stmt); if (!use_stmt_info || !PURE_SLP_STMT (vect_stmt_to_vectorize (use_stmt_info))) { STMT_VINFO_LIVE_P (stmt_info) = true; specifically the last check. That's supposed to pick up the "main" pattern that's now covering the scalar stmt. But somehow the "main" pattern, patt_67 = .VEC_WIDEN_MINUS (_1, _3); // _5 = _2 - _4; patt_68 = (signed short) patt_67; // _5 = _2 - _4; patt_69 = (int) patt_68; // _5 = _2 - _4; doesn't get picked up here. I wonder what's the orig_stmt and the def picked and what original scalar use we end up in where the vect_stmt_to_vectorize isn't the "last" pattern. Maybe we really want these "overlapping" patterns, but IMHO having "two entries" into a chain of scalar stmts is bad and we should link up the whole matched sequence to the final "root" instead? That said, the current code doesn't see that wherever we end up isn't dead code (aka fully covered by the vectorization). IMO vect_stmt_to_vectorize for each of those stmts should end up at patt_69 = (int) patt_68;
next prev parent reply other threads:[~2023-12-20 13:09 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-20 9:54 [Bug tree-optimization/113091] New: " fxue at os dot amperecomputing.com 2023-12-20 13:09 ` rguenth at gcc dot gnu.org [this message] 2023-12-21 5:25 ` [Bug tree-optimization/113091] " fxue at os dot amperecomputing.com 2023-12-21 5:27 ` fxue at os dot amperecomputing.com 2023-12-21 7:31 ` rguenth at gcc dot gnu.org 2023-12-21 11:01 ` rsandifo at gcc dot gnu.org 2023-12-22 3:55 ` fxue at os dot amperecomputing.com 2023-12-26 15:16 ` fxue at os dot amperecomputing.com 2023-12-29 10:35 ` fxue at os dot amperecomputing.com 2024-01-16 3:36 ` cvs-commit at gcc dot gnu.org 2024-01-31 3:13 ` fxue at os dot amperecomputing.com
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-113091-4-6b5zddNv5e@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).