From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61E603858C62; Wed, 9 Aug 2023 23:15:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61E603858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691622927; bh=H0qsqvWKAa3caEl/+4crrIXhziz4iW7EH/mYosbBnfY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ja4n7fm8d9FfCRsPTMda7PW3p51O9wBPu02FtF3GSEeLwF9S7h7trt8JcqMZmQ4YK QB6AQC3tq/O6zLEb/8GitSUPqTeiz0Qmli0xy2O0IarOfObe30a0FGAWErxcPEClht iZ6ATsNweGInCNuoMsUSDCqgoAQZjBnqdQG1LaiM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/80641] missed optimization with with std::vector resize in loop Date: Wed, 09 Aug 2023 23:15:25 +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: 7.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 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=3D80641 --- Comment #16 from Andrew Pinski --- Note starting in GCC 13 at -O3, we are able to optimize this all the way to: ``` int f () { int * _54; [local count: 114863531]: _54 =3D operator new (16); MEM [(char * {ref-all})_54] =3D 0x30000000200000001; operator delete (_54, 16); return 0; } ``` If we change the name of the function to f rather than main. In GCC 14 we a= ble to optimize even without the name change (there has been some inlining heur= stic changes there).=