From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 162283886C5B; Fri, 28 May 2021 10:54:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 162283886C5B From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100801] Aggressive loop optimizations cause incorrect warning Date: Fri, 28 May 2021 10:54:26 +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: 11.1.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: component keywords bug_status everconfirmed cf_reconfirmed_on assigned_to 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: Fri, 28 May 2021 10:54:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100801 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Component|ipa |tree-optimization Keywords| |diagnostic, | |missed-optimization Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2021-05-28 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #1 from Richard Biener --- Confirmed. We're warning on the obviously unreachable loop since: [local count: 1073741824]: _35 =3D 12; if (_35 !=3D 12) goto ; [75.00%] else goto ; [25.00%] $3 =3D since we apply final value replacement to 'i' in sccp but do not propagate = it before the next number of iteration analysis in ivcanon: NEXT_PASS (pass_tree_loop_init); NEXT_PASS (pass_tree_unswitch); NEXT_PASS (pass_scev_cprop); <<<< final value repl. NEXT_PASS (pass_loop_split); NEXT_PASS (pass_loop_versioning); NEXT_PASS (pass_loop_jam); /* All unswitching, final value replacement and splitting can exp= ose empty loops. Remove them now. */ NEXT_PASS (pass_cd_dce, false /* update_address_taken_p */); NEXT_PASS (pass_iv_canon); <<<<< warning NEXT_PASS (pass_loop_distribution); NEXT_PASS (pass_linterchange); NEXT_PASS (pass_copy_prop); <<<<<< propagation IIRC final value replacement used to propagate and fold but I(?) removed th= is at some point.=