From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 500923858D35; Tue, 20 Feb 2024 09:58:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 500923858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708423129; bh=OPuiSET1cHw6FVPl1vivx4eQQgqfxhEbuYE3CNdQspE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QV2K7LzZ/qjlTjp4pGiN4AZeEKXz5ZcvEKenIqY5xlMMHcsvfZ0SZ3d43aJwUrEsg 0Hb7INXLP2uRsQ5YVURm8JsQKgvLSSEDqslVAfgcYWCeM7va/vAyvk+meiu4WoPkFp 0ZtMPyGcwwjFkIpLUzSMnXFcMTLWWnmvzaWvClG8= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109945] Escape analysis hates copy elision: different result with -O1 vs -O2 Date: Tue, 20 Feb 2024 09:58:46 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 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=3D109945 --- Comment #22 from Richard Biener --- Ping. Jakub/Jason - we now have three open bugs because of this. The patch in comment#12 works but Jakub doesn't like it. Instead as far as I understand we need a flag to tell us whether there's guaranteed copy elision (in which case the programmer can expect using the return slot address will "work", maybe be even well-defined). As can be seen with the testcases TREE_ADDRESSABLE on the type does not cover all cases where that's appearantly so. Maybe those types simply need to have TREE_ADDRESSABLE set as otherwise RTL expansion or gimplificat= ion might introduce an additional copy, breaking copy elision?=