From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 380F53858C54; Wed, 24 May 2023 08:16:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 380F53858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684916172; bh=P6IcKTRxKCL7hQelWGSiYnuGF9YvQIKPG+XYKRU+OLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KOFy0nai7wdJZJejmtrhzEJrQa/9h6jEZi++MDKA9kf9N4XdgjE0Na0fsuSqu/0xB 2JpdFJjdM9UOx0NtBe36TnIgsRqwUg9FmqjNgNDspgzsB5wdrJXZ1mdPiZ4WaEp9kc htUAVh43p6MzA8rduqdVC4NbQonKFOL0aqAH0UCk= From: "jakub 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: Wed, 24 May 2023 08:16:11 +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: jakub 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=3D109945 --- Comment #14 from Jakub Jelinek --- (In reply to Richard Biener from comment #13) > with the former for -m64 and the latter for -m32 only seems to be the > only fallout here. It will penalize C and other languages without mandatory NRV in the FEs, without that I think the address can't escape (taking address then would ei= ther prevent tree-nrv.cc or even if not, would be still considered taking address of a local variable). Perhaps we could remember in some FUNCTION_DECL bit whether mandatory NRV w= as done and least for the cases where we know the callee, we know it hasn't done NRV and !TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt)))) we could avoid this. But perhaps it is an overkill.=