From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 244D83858D39; Tue, 14 Mar 2023 04:58:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 244D83858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678769911; bh=IKSox3lCSjhzHp6QbPI5uDsNbIG2AWCV7HPWODmszM4=; h=From:To:Subject:Date:From; b=mqIJ6UG0wx4YZRrw59LEsWV71vFH6W848W5uYXDz4sGo5nqJ8LNy24X+0K1v04AFc YUzxrcnmI/H1aCf3Ntd7su1uRGa71+N17TieRbEs5l4PZGAcqAzqtXgNam2IvK5AKI PLGF9WgfJ9QHW0AmUHDjgXoqbyKvpkbfolaEdt80= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109119] New: missing loading fre with branch comparing two pointers Date: Tue, 14 Mar 2023 04:58:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109119 Bug ID: 109119 Summary: missing loading fre with branch comparing two pointers Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` void fun (unsigned *x, unsigned *b) { asm volatile(""::"r"(*x)); unsigned *a =3D b;//malloc (*x); if (a =3D=3D 0) return; if (a !=3D x) // (A) *a =3D *x; *x =3D *a; } ``` GCC currently produces: [local count: 1073741824]: _1 =3D *x_6(D); __asm__ __volatile__("" : : "r" _1); if (b_7(D) =3D=3D 0B) goto ; [18.09%] else goto ; [81.91%] [local count: 879501929]: if (x_6(D) !=3D b_7(D)) goto ; [70.00%] else goto ; [30.00%] [local count: 263850576]: pretmp_10 =3D *b_7(D); goto ; [100.00%] [local count: 615651353]: *b_7(D) =3D _1; [local count: 879501929]: # prephitmp_11 =3D PHI *x_6(D) =3D prephitmp_11; But pretmp_10 should be the same as _1 as at that point b_7 =3D=3D x_6. Note I noticed this while looking into PR 96564.=