From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 098703858292; Tue, 5 Jul 2022 12:53:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 098703858292 From: "matz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 Date: Tue, 05 Jul 2022 12:53:11 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code, needs-bisection, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: matz at gcc dot gnu.org 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: 11.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: Tue, 05 Jul 2022 12:53:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106192 --- Comment #2 from Michael Matz --- Unroll-and-jam simply unrolls the outer loop and merged all resulting inner-loop bodies. In this situation we have (before unroll-and-jam): outerloop(i_1) { _12 =3D i_1 <=3D 59 innerloop(i_1, j by 1) { .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12); ... uninteresting things (j) ... } } Unroll-and-jam then simply does (that's the unrolling): outerloop(i by 2) { _12 =3D i_1 <=3D 59 innerloop(i_1, j by 1) { .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12); ... uninteresting things (i, j) ... } i_2 =3D i_1 + 1 _15 =3D i_2 <=3D 59 innerloop(i_2, j by 1) { .GOMP_SIMD_LANE (simduid.6_16(D), 0, _15); ... uninteresting things (i + 1, j) ... } } and then fuses the two inner loops, which means that the instructions betwe= en them (the original pre-header of the inner loop) become replicated inside the new inner loop body (here, the loop-invariant condition): outerloop(i by 2) { _12 =3D i_1 <=3D 59 innerloop(i_1, j by 1) { .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12); ... uninteresting things (i, j) ... i_2 =3D i_1 + 1 _15 =3D i_2 <=3D 59 .GOMP_SIMD_LANE (simduid.6_16(D), 0, _15); ... uninteresting things (i + 1, j) ... } } There is nothing which somehow would indicate that this is invalid, and I c= an't see why it should be. If GIMP_SIMD_LANE has properties that make this transformation invalid I would argue that those properties are correctly represented. One could of course hack bb_prevents_fusion_p or unroll_jam_possible_p to avoid this situation, but that would seem like a bad hack, as random other CFG transformation might introduce similar things: namely a GOMP_SIMD_LANE statement that's fed by an unhoisted loop-invariant condition. So, I'd argue the assert is too eager.=