From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D99243858D35; Mon, 9 Oct 2023 11:12:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D99243858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696849929; bh=i64b0CPb7wUFLmjzHxu2cR/uVB2KEs28Q4G60kvpqaI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K6J2ErF57AEse8BMDJR6P+rdCJO+soKDOXOOmkxVMaeyLDUNu/5n0NJMDNqHT1qvz mHxzabzN9XxoB69XkWzX7SROib2ErPaOR15pmG05IUfumesP1qbIM8NDrWQPpTq/Xg /WsMIfzyVM7YdYY7sjIsOwx8DH4tB++Unb3qxBCE= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA Date: Mon, 09 Oct 2023 11:12:09 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D111715 --- Comment #3 from Richard Biener --- Reduced testcase: struct B { struct { int len; } l; long n; }; struct A { struct B elts[8]; }; static void set_len (struct B *b, int len) { b->l.len =3D len; } static int get_len (struct B *b) { return b->l.len; } int foo (struct A *a, int i, long *q) { set_len (&a->elts[i], 1); *q =3D 2; return get_len (&a->elts[i]); } with the patch we end up doing the following in FRE1. I think the path based disambiguation is unaffected by assigning a different alias set. int foo (struct A * a, int i, long int * q) { int D.2787; - int _9; : MEM [(struct B *)a_3(D)].elts[i_4(D)].l.len =3D 1; *q_7(D) =3D 2; - _9 =3D MEM [(struct B *)a_3(D)].elts[i_4(D)].l.len; - return _9; + return 1;=