From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EE1563858CDA; Mon, 22 May 2023 15:31:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE1563858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684769508; bh=J8CN18AK7NIbgo4tvCXwK/e91U/FkXbrL0FGIzVhom8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LG5jbv7nVr0nqULPcuBP14LPCl10ID+XwDSxioYoUkStvivlMxK1E13Un6KgY09sS tM8X+V/zZs7hCRBcen8/QvkKU5PUgBw4MF25iHcSpt0A3TZdps0IjLdOE8xcwIDzB5 8E9S8FSQ9a6VT8iBtI1n04aCbcc7Ihv37ANxjzcQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/109930] transform atomic exchange to unconditional store when old value is unused? Date: Mon, 22 May 2023 15:31:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cf_gcctarget everconfirmed cf_reconfirmed_on keywords bug_status bug_severity 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=3D109930 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |!i*86-* & !x86_64-* Ever confirmed|0 |1 Last reconfirmed| |2023-05-22 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Severity|normal |enhancement --- Comment #2 from Andrew Pinski --- Testcase: ``` #include std::atomic x; void f() { auto old_value =3D x.exchange(5); (void)old_value; } void f0() { x =3D 5; } ``` Note on x86_64, these produce the same code generation anyways. Though on aarch64, it does produce different code.=20 I have a suspicion this was reported against x86_64 originally thinking the= se two might produce different code generation ...=