From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E817A385781C; Mon, 1 Feb 2021 09:35:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E817A385781C From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/98848] [9/10/11 regression] vectorizer failed to reduce max pattern since r9-1590 Date: Mon, 01 Feb 2021 09:35:34 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:35:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98848 --- Comment #7 from rguenther at suse dot de --- On Mon, 1 Feb 2021, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98848 >=20 > --- Comment #6 from Jakub Jelinek --- > So what about punting if the lhs of the possible over_widen pattern is a = PHI on > loop header? That would be STMT_VINFO_DEF_TYPE (stmt_info) =3D=3D vect_reduction_def, elsewhere we now use vect_reassociating_reduction_p, not sure if that woudl apply here, too. > --- gcc/tree-vect-patterns.c.jj 2021-01-04 10:25:38.650235896 +0100 > +++ gcc/tree-vect-patterns.c 2021-02-01 10:13:51.755008757 +0100 > @@ -1579,6 +1579,20 @@ vect_recog_over_widening_pattern (vec_in > tree type =3D TREE_TYPE (lhs); > tree_code code =3D gimple_assign_rhs_code (last_stmt); >=20 > + /* Punt if lhs might be used in a reduction. */ > + if (loop_vec_info loop_vinfo =3D dyn_cast (vinfo)) > + { > + use_operand_p use_p; > + imm_use_iterator iter; > + FOR_EACH_IMM_USE_FAST (use_p, iter, lhs) > + { > + gimple *use_stmt =3D USE_STMT (use_p); > + if (gimple_code (use_stmt) =3D=3D GIMPLE_PHI > + && gimple_bb (use_stmt) =3D=3D LOOP_VINFO_LOOP (loop_vinfo)= ->header) > + return NULL; > + } > + } > + > /* Keep the first operand of a COND_EXPR as-is: only the other two > operands are interesting. */ > unsigned int first_op =3D (code =3D=3D COND_EXPR ? 2 : 1); >=20 > doesn't regress any vect.exp=3D*over-widen* tests and let's this testcase= be > vectorized. >=20 >=