From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5E0D3814FEB; Mon, 30 May 2022 09:10:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5E0D3814FEB From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/53533] [10/11/12/13 regression] vectorization causes loop unrolling test slowdown as measured by Adobe's C++Benchmark Date: Mon, 30 May 2022 09:10:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.7.1 X-Bugzilla-Keywords: missed-optimization 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: 10.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, 30 May 2022 09:10:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53533 --- Comment #47 from Hongtao.liu --- >=20 > The issue is that the re-association pass doesn't handle operations > with undefined overflow behavior, we do have duplicate bugreports > for this. >=20 I saw below in match.pd 478/* Combine successive multiplications. Similar to above, but handling 479 overflow is different. */ 480(simplify 481 (mult (mult @0 INTEGER_CST@1) INTEGER_CST@2) 482 (with { 483 wi::overflow_type overflow; 484 wide_int mul =3D wi::mul (wi::to_wide (@1), wi::to_wide (@2), 485 TYPE_SIGN (type), &overflow); 486 } 487 /* Skip folding on overflow: the only special case is @1 * @2 =3D=3D -INT_MIN, 488 otherwise undefined overflow implies that @0 must be zero. */ 489 (if (!overflow || TYPE_OVERFLOW_WRAPS (type)) 490 (mult @0 { wide_int_to_tree (type, mul); })))) Can it be extend to (mult (plus_minus (mult @0 INTEGER_CST@1) INTEGER_CST@3) INTEGER_CST@2), so at least we can handle it under -fwrapv?=