From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C96AC3858D3C; Mon, 11 Oct 2021 08:34:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C96AC3858D3C From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102650] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) Date: Mon, 11 Oct 2021 08:34:27 +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: rguenth 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.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords target_milestone everconfirmed bug_status cf_reconfirmed_on short_desc 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: Mon, 11 Oct 2021 08:34:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102650 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Target Milestone|--- |12.0 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2021-10-11 Summary|Dead Code Elimination |[12 Regression] Dead Code |Regression at -O3 (trunk vs |Elimination Regression at |11.2.0) |-O3 (trunk vs 11.2.0) --- Comment #2 from Richard Biener --- (In reply to Andrew Macleod from comment #1) > This is a result of the vagaries of the single subrange value-range. >=20 > VRP is seeing: > # f_11 =3D PHI <-1(2), 2(3)> > goto ; [100.00%] >=20 > [local count: 955630225]: > _3 =3D (unsigned short) f_11; > _6 =3D _3 + 2; > e_19 =3D (short int) _6; >=20 > It knows f_11 is [-1, 2] and when that is cast to a ushort, produces ~[3, > 65534]. >=20 > That is all we knew about it in GCC11, so when we calculate_6 =3D ~[3,655= 34] + > 2 it comes up with [1,4] and the e_19 =3D=3D 0 later on then can be fold= ed away. >=20 > in gcc12, EVRP has figured out that _3 is unsigned short [2, 2][+INF, +IN= F]. > which if we add 2 to it, would come up with [1,1][4,4] which would be > perfect. >=20 > We save this to the value_range global table in EVRP, but alas it gets > transliterated to a single pair value_range : _3 : unsigned short [2, +I= NF] That translation could see whether the corresponding anti-rante ~[3,65534] = is smaller (which it is) and use that instead?=