From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 176883858401; Wed, 22 Dec 2021 09:35:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 176883858401 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/89922] Loop on fixed size array is not unrolled and poorly optimized at -O2 Date: Wed, 22 Dec 2021 09:35: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: 9.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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: component bug_severity 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2021 09:35:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89922 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |tree-optimization Severity|normal |enhancement --- Comment #6 from Andrew Pinski --- Estimating sizes for loop 1 BB: 3, after_exit: 0 size: 1 _1 =3D .data[j_16]; size: 1 _2 =3D _1 + j_16; size: 1 .data[j_16] =3D _2; size: 1 j_13 =3D j_16 + 1; Induction variable computation will be folded away. size: 1 ivtmp_4 =3D ivtmp_18 - 1; Induction variable computation will be folded away. size: 2 if (ivtmp_4 !=3D 0) Exit condition will be eliminated in peeled copies. Exit condition will be eliminated in last copy. Constant conditional. BB: 5, after_exit: 1 size: 7-4, last_iteration: 7-4 Loop size: 7 Estimated size after unrolling: 10 Not unrolling loop 1: size would grow.=