From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 68A1D385840F; Wed, 17 Jan 2024 12:59:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68A1D385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705496360; bh=bzu4i2srbGn+sO/gtL0On8SvuoXbSfsBgn6iymgw6PM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ykc+GhIIIihPq5uViePg+FHDeU50Hc27+V9PnpVnk/4nJaAj2bIehJ1myuhaIQ35m frbWNAYnuyWzWPPMpANxvlL8Dr1p8x51QJezUwh18GwlsTICgDINeja7UU1BoZAm5L 6haKls3WN2mursQs5rZb/69qyg9IqEcFvtolS8mw= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113431] [14 Regression] Wrong code at -O3 Date: Wed, 17 Jan 2024 12:59:20 +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: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth 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=3D113431 --- Comment #14 from Richard Biener --- So the issue is that we ignore the dependence because vect_preserves_scalar_order_p - which is correct iff we'd execute the stmt within the vectorized loop body. But as we discover it invariant we hoist it, making the outcome of vect_preserves_scalar_order_p invalid. I have a fix doing t.c:5:17: note: =3D=3D=3D vect_prune_runtime_alias_test_list =3D=3D=3D t.c:5:17: note: can tell at compile time that a[0][1] and a[b.2_8][1] ali= as t.c:7:15: missed: not vectorized: compilation time alias: _18 =3D a[0][1]; a[b.2_8][1] =3D _20; and then falling back to SLP vectorizing the unrolled loop as desired.=