From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB0B63858D38; Tue, 17 Oct 2023 06:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB0B63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697525810; bh=3emOHA8G4MibHyjT8OFtAa7RJ7aIKqJs3lwdnw08Ci8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QEvPLy8dP7AR7/yrH4xHeT5W+c0lncbqqN2fGB5L4MyIsxKlJfcyxERbsZMpsArnC ek0Gkxui0fUyDK6Xt8cePy8oaOlPq418Gm3hMcvND0fajqJIb4GPJF7ZlUoAqRU0wd tAt0FyZB2FBZ51RGS1g+fDhrkSguY3FkuVOFwKEk= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111820] [13/14 Regression] Compiler time hog in the vectorizer with `-O3 -fno-tree-vrp` Date: Tue, 17 Oct 2023 06:56:50 +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: compile-time-hog, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com 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: 13.3 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=3D111820 --- Comment #7 from Hongtao.liu --- (In reply to rguenther@suse.de from comment #6) > On Mon, 16 Oct 2023, crazylht at gmail dot com wrote: >=20 > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111820 > >=20 > > --- Comment #5 from Hongtao.liu --- > > (In reply to Richard Biener from comment #3) > > > for (unsigned i =3D 0; i !=3D skipn - 1; i++) > > > begin =3D wi::mul (begin, wi::to_wide (step_expr)); > > >=20 > > > (gdb) p skipn > > > $5 =3D 4294967292 > > >=20 > > > niters is 4294967292 in vect_update_ivs_after_vectorizer. Maybe the = loop > > > should terminate when begin is zero. But I wonder why we pass in 'ni= ters' > > Here, it want to calculate begin * pow (step_expr, skipn), yes we can j= ust skip > > the loop when begin is 0. >=20 > I mean terminate it when the multiplication overflowed to zero. for pow (3, skipn), it will never overflowed to zero. To solve this problem once and for all, I'm leaning towards setting a thres= hold in vect_can_peel_nonlinear_iv_p for vect_step_op_mul,if step_expr is not exact_log2() and niter > TYPE_PRECISION (step_expr) we give up on doing vectorization. >=20 > As for the MASK_ thing the skip is to be interpreted negative (we > should either not use a 'tree' here or make it have the correct type > maybe). Can we even handle this here? It would need to be > a division, no? >=20 > So I think we need to disable non-linear IV or masked peeling for > niter/aligment? But I wonder how we run into this with plain -O3. I think we already disabled negative niters_skip in vect_can_peel_nonlinear_iv_p. 416 /* Also doens't support peel for neg when niter is variable. 1417 ??? generate something like niter_expr & 1 ? init_expr : -init_exp= r?=20 */ 1418 niters_skip =3D LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo); 1419 if ((niters_skip !=3D NULL_TREE 1420 && TREE_CODE (niters_skip) !=3D INTEGER_CST) 1421 || (!vect_use_loop_mask_for_alignment_p (loop_vinfo) 1422 && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)) 1423 { 1424 if (dump_enabled_p ()) 1425 dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 1426 "Peeling for alignement is not supported" 1427 " for nonlinear induction when niters_skip" 1428 " is not constant.\n"); 1429 return false; 1430 }=