From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0BC5E385829F; Tue, 9 Jan 2024 09:32:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BC5E385829F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704792748; bh=B6/N9Xhgi6n2ai8GAmyXp/Cb7v1RE+jf61Gmv+V+LYQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z7hcBNcS+D3ZrvAeCL//OEF/jQFk0CNVdqUDBtL7TUi7creUNtqvACiJ5pFyQk3pM 1DtZ8nmxPmyF9jE2ZfkxNjmgGIBdVsIVb57q6t6r3JvwB4nhdBX/CB4UtnIG/EMFLF w1fuZljuJT7bNLgiJ4S6SHGwClty0AkGaiyH6iyI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113210] [14 Regression] ICE: tree check: expected integer_cst, have cond_expr in get_len, at tree.h:6481 Date: Tue, 09 Jan 2024 09:32:27 +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: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D113210 --- Comment #17 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b1d4e5b51375efd285378173375d634ad6ba8462 commit r14-7030-gb1d4e5b51375efd285378173375d634ad6ba8462 Author: Jakub Jelinek Date: Tue Jan 9 10:31:51 2024 +0100 vect: Ensure both NITERSM1 and NITERS are INTEGER_CSTs or neither of th= em [PR113210] On the following testcase e.g. on riscv64 or aarch64 (latter with -O3 -march=3Darmv8-a+sve ) we ICE, because while NITERS is INTEGER_CST, NITERSM1 is a complex expression like (short unsigned int) (a.0_1 + 255) + 1 > 256 ? ~(short unsigned int) (a= .0_1 + 255) : 0 where a.0_1 is unsigned char. The condition is never true, so the above is equivalent to just 0, but only when trying to fold the above with PLUS_EXPR 1 we manage to simplify it (first ~(short unsigned int) (a.0_1 + 255) to -(short unsigned int) (a.0_1 + 255) and then (short unsigned int) (a.0_1 + 255) + 1 > 256 ? -(short unsigned int) (a= .0_1 + 255) : 1 to (short unsigned int) (a.0_1 + 255) >=3D 256 ? -(short unsigned int) (a.= 0_1 + 255) : 1 and only at this point we fold the condition to be false. But the vectorizer seems to assume that if NITERS is known (i.e. suitab= le INTEGER_CST) then NITERSM1 also is, so the following hack ensures that = if NITERS folds into INTEGER_CST NITERSM1 will be one as well. 2024-01-09 Jakub Jelinek PR tree-optimization/113210 * tree-vect-loop.cc (vect_get_loop_niters): If non-INTEGER_CST value in *number_of_iterationsm1 PLUS_EXPR 1 is folded into INTEGER_CST, recompute *number_of_iterationsm1 as the INTEGER_C= ST minus 1. * gcc.c-torture/compile/pr113210.c: New test.=