From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF2573858D28; Fri, 22 Dec 2023 20:30:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF2573858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703277021; bh=AW6AzQEomNWA1kuVuTnEX1TbU9EclmmaDSrf28PQt+Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X/hNXzolE93gAZIT7QP+3j8em4qO6vnU/9WOwOqm9xkwQQgDiWakcOQCKdqirhuu2 atn5oE4I+9M04PHXooMPKvoZn9Zn2yypVWruSPRQfTyDPO7wsq55kJ6oPCBx97J79t YY40xl/qhx/cREEY7LwwGKA0f3y+DKyUoF8izvVw= From: "phosit at autistici dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/86072] Poor codegen with atomics Date: Fri, 22 Dec 2023 20:30: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: 9.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: phosit at autistici dot 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: cc 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=3D86072 Phosit changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phosit at autistici dot org --- Comment #4 from Phosit --- (In reply to Richard Biener from comment #2) > Somebody has to decide if it's worth optimizing them and has to sit down = and > exactly specify what kind of optimizations are valid. There is a paper about the optimization of atomics. It might not be detailed enough. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4455.html Note that the memory-model changed a bit since the release of that paper. > I guess it's worth optimizing them if these cases appear in real-world co= de > (and then we'd like to see examples). std::shared_ptr use fetch_add and fetch_sub. When a std::shared_ptr is not = used for syncronization this optimization could take effect. PR 48987 is specifically about combining multiple fetch_add and fetch_sub.=