From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 44AFB3858D32; Mon, 12 Jun 2023 17:39:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44AFB3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686591575; bh=C6gov/AbTJ4c0O0PVp6OxwzXEFcQIV6wr/QHBf6C+44=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NzUPkEDlA5O06pxrNTKJ3XY//UjDUg7Of5vD2Z9Ai0mx/0erx4kSH8mwM5aBhPfR+ L+fwehqJhY9gVetKr4IoBFe4dLdb0RVmceYvzCbz0rPbKX7ZvLyeYrdOxv1/PNtYeT SixxRqYNCqyVLpst/UvqHas4PGiVS+pVWLcHbDmk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110228] [14 Regression] llvm-16 miscompilation on small case switch, minimized Date: Mon, 12 Jun 2023 17:39:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code 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: 14.0 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=3D110228 --- Comment #4 from Andrew Pinski --- Phiopt does this: ``` v_13 =3D=3D 1 ? 1 : LookupFlags_6 Matching expression match.pd:1990, gimple-match-5.cc:23 Matching expression match.pd:1990, gimple-match-5.cc:23 Matching expression match.pd:2479, gimple-match-4.cc:35 Matching expression match.pd:2482, gimple-match-3.cc:66 Matching expression match.pd:2489, gimple-match-2.cc:58 Matching expression match.pd:1947, gimple-match-7.cc:20 Applying pattern match.pd:4742, gimple-match-7.cc:15326 Folded into the sequence: _17 =3D v_13 =3D=3D 1; _18 =3D LookupFlags_6 | _17; Removing basic block 5 ;; basic block 5, loop depth 1 ;; pred: 4 ;; succ: 6 ``` As zero_one_valued_p returns true for LookupFlags_6 because tree_nonzero_bits/get_nonzero_bits returns 1 for it. So it is ranger in the end that returns that it has a nonzero bits of 1. Which is completely wrong as LookupFlags_6 is defined by: # LookupFlags_6 =3D PHI Which has an uninitialized variable in it which is not defined at what its value would be ....=