From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81A8C3858C20; Fri, 1 Jul 2022 02:32:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81A8C3858C20 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106155] [12/13 Regression] spurious "may be used uninitialized" warning Date: Fri, 01 Jul 2022 02:32:45 +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: 13.0 X-Bugzilla-Keywords: diagnostic, 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: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on keywords bug_status target_milestone everconfirmed 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, 01 Jul 2022 02:32:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106155 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-07-01 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Target Milestone|--- |12.2 Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- init_from_control_deps {{0 -> 3}}: i_44 !=3D 2 (expanded) NOT (i_44 =3D=3D 2) After normalization [DEF]: i_44 !=3D 2 (expanded) NOT (i_44 =3D=3D 2) After normalization [USE]: f2 (emax_8); is conditional on: ivtmp.7_37 =3D=3D 2 (expanded) ivtmp.7_37 =3D=3D 2 Which is funny we get: # ivtmp.7_37 =3D PHI i_44 =3D (int) ivtmp.7_37; if (i_44 =3D=3D 2) goto ; [12.49%] else goto ; [87.51%] .... if (ivtmp.7_37 =3D=3D 2) goto ; [12.49%] else goto ; [87.51%] [local count: 268435456]: f2 (emax_8); I don't know why ivopts only changed the second if and not the first. Oh because the second is the exit check: Replacing exit test: if (ivtmp_39 !=3D 0) Replacing exit test: if (i_40 =3D=3D 2) If we change the size to 4 and keep the 2 as 2, there would be no warning. And if then change 2 to 3, the warning is back. So there is a missed optimization of changing the internal comparison for t= he IV to the new type if the right side is a constant.=