From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF5E33858C60; Tue, 16 Jan 2024 03:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF5E33858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705376197; bh=nEFtvwYAMH7HlA+o9/eAWB9W23JVMeJGhocGjJl+Mb0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TzJwd9HtZKkFXyBIN1sZCLLdOj1PRPifhJB1A7FpGp0pleW+Nvytg1nLl463YtXNZ drzr1xaEZykZ5lW+wp6OGvdEprmk/bQf2vj0ITnS+UDtknBoVKBZkuI9c/UGm1uxXw QdcUB0BhYTovT8x7UFWYTCgU8EKrjXyCRMfZhE8w= From: "cvs-commit at gcc dot 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: Tue, 16 Jan 2024 03:36:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113091 --- Comment #9 from GCC Commits --- The master branch has been updated by Feng Xue : https://gcc.gnu.org/g:57f611604e8bab67af6c0bcfe6ea88c001408412 commit r14-7272-g57f611604e8bab67af6c0bcfe6ea88c001408412 Author: Feng Xue Date: Thu Dec 28 16:55:39 2023 +0800 Do not count unused scalar use when marking STMT_VINFO_LIVE_P [PR113091] When pattern recognition is involved, a statement whose definition is consumed in some pattern, may not be included in the final replacement pattern statements, and would be skipped when building SLP graph. * Original char a_c =3D *(char *) a; char b_c =3D *(char *) b; unsigned short a_s =3D (unsigned short) a_c; int a_i =3D (int) a_s; int b_i =3D (int) b_c; int r_i =3D a_i - b_i; * After pattern replacement a_s =3D (unsigned short) a_c; a_i =3D (int) a_s; patt_b_s =3D (unsigned short) b_c; // b_i =3D (int) b_c patt_b_i =3D (int) patt_b_s; // b_i =3D (int) b_c patt_r_s =3D widen_minus(a_c, b_c); // r_i =3D a_i - b_i patt_r_i =3D (int) patt_r_s; // r_i =3D a_i - b_i The definitions of a_i(original statement) and b_i(pattern statement) are related to, but actually not part of widen_minus pattern. Vectorizing the pattern does not cause these definition statements to be marked as PURE_SLP. For this case, we need to recursively check whether their uses are all absorbed into vectorized code. But there is an exception that some use may participate in an vectorized operation via an external SLP node containing that use as an element. gcc/ChangeLog: PR tree-optimization/113091 * tree-vect-slp.cc (vect_slp_has_scalar_use): New function. (vect_bb_slp_mark_live_stmts): New parameter scalar_use_map, ch= eck scalar use with new function. (vect_bb_slp_mark_live_stmts): New function as entry to existing overriden functions with same name. (vect_slp_analyze_operations): Call new entry function to mark live statements. gcc/testsuite/ChangeLog: * gcc.target/aarch64/bb-slp-pr113091.c: New test.=