From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D91383858C39; Tue, 9 Apr 2024 07:08:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D91383858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712646481; bh=uDjJHivD7YRyuSlbqJSMY2FRydwql7sP2xJPKoPjBzs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lIBOl0zeK9yMW2FsSk/G/k7e+1QzAZzKFinJJKv7SmRmzb2kuLI+k/AdPge2fpBBV k3eYJEbfyl1rmUpKqBy14j1A/DSe90LRpJpRXeLkqkfvNnNQR//DbttNVdnpZz0k6Y MxmLke5r27s3IdksoaIKkY2ZBrhz6tX4vxi8dHhc= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/59739] missed optimization: attribute ((pure)) with aggregate returns Date: Tue, 09 Apr 2024 07:07:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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=3D59739 --- Comment #7 from Andrew Pinski --- >From PR 108635 (via PR 45115), a C++20 testcase where we should be able to optimize into one call of `operator<=3D>`: #include struct S { std::weak_ordering operator<=3D>(const S&) const __attribute__((con= st)); }; int compare3way(S& a, S& b) { return (a < b) ? -1 : (a > b) ? 1 : 0; }=