From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DF553858D20; Wed, 31 May 2023 06:34:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DF553858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685514886; bh=LWX0+P6E2ZWLITSQB1dP9pIPSn1kZ0NTz5xByA6TYFs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P1B4za072cA5WNFXl+rAZ7uY0A1PONZao2zuDmmh3MM3EodIVz/iq2BKbpiaY55Pe vcjYpzcV+xMjgNMaf5ZqGWxmZf5+BWppe+ijiUDWbeAQn1TKC3b9iT5mfLiTyrCO5U GxC5+CGdllqiLAktwEiVq8qIU7l9U+4K8xyVxDog= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110035] Missed optimization for dependent assignment statements Date: Wed, 31 May 2023 06:34: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: 12.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenther at suse dot de 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=3D110035 --- Comment #6 from rguenther at suse dot de --- On Tue, 30 May 2023, pinskia at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110035 >=20 > Andrew Pinski changed: >=20 > What |Removed |Added > -------------------------------------------------------------------------= --- > Keywords| |missed-optimization > Ever confirmed|0 |1 > Severity|normal |enhancement > Last reconfirmed| |2023-05-30 > Status|UNCONFIRMED |NEW >=20 > --- Comment #2 from Andrew Pinski --- > More obvious Reduced testcase: > ``` > struct MyClass > { > unsigned long long arr[128]; > }; >=20 > [[gnu::noipa]] > void sink(void *m){} > void gg(MyClass &a) > { > MyClass c =3D a; > MyClass *b =3D new MyClass; > *b =3D c; > sink(b); > } > ``` >=20 > There might be a dup of this issue too. But we cannot move the load of 'a' across the call to operator new since that can possibly clobber 'a' (you can overwrite 'new' with something having observable side-effects)=