From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 28489385559D; Mon, 1 May 2023 23:49:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28489385559D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682984974; bh=n7rUutw/onV67XZkYTE1xjFzg0229cRgxucNrMI8nm0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NyrwoQLHRAex4Kk95miQeLrRdii7SDnpQH6OEISr1Hm+Uz48PNovmCqR1bMd9kHnW X5D67ARHCo33BmAPOVO7/PKm6itUsS6lCUFDzIh5YV/3R5RZ3wNwQwUafsPa0Nlr8I hpVtETPWw5wVZfnBiXhvrzDYiUSl72aH3hIqsoQk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103281] [10/12/13/14 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) Date: Mon, 01 May 2023 23:49:33 +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: 12.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: 10.5 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=3D103281 --- Comment #8 from Andrew Pinski --- Hmm: # RANGE [irange] char [0, 2] NONZERO 0x3 c_9 =3D (charD.7) b.4_5; _1 =3D c_9 <=3D 0; Should _1 be replaced with c_9 =3D=3D 0 which then can be simplified to b.4= _5 =3D=3D 0 That is PR 28794 I think. And then after that we get: b.4_5 =3D=3D (unsigned int)(b.4_5 =3D=3D 0) Which should be optimized down to false though we don't either. unsigned f(unsigned t) { unsigned a =3D t =3D=3D 0; return t =3D=3D a; } The general CST cases (I hope I did these correctly): a =3D=3D (a =3D=3D CST) -> CST =3D=3D 0 -> false CST =3D=3D 1 -> a =3D=3D 1 | a =3D=3D 0 others -> a =3D=3D 0 a !=3D (a =3D=3D CST) -> CST =3D=3D 0: false CST =3D=3D 1: a !=3D 0 || a !=3D 1 others : a !=3D 0 a !=3D (a !=3D CST) -> CST =3D=3D 0: a =3D=3D 1 | a =3D=3D 0 CST =3D=3D 1: true others : a !=3D 1 a =3D=3D (a !=3D CST) -> CST =3D=3D 0: a =3D=3D 1 | a =3D=3D 0 CST =3D=3D 1: false others : a =3D=3D 1=