From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F1F2385DC05; Fri, 15 Sep 2023 03:19:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F1F2385DC05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694747942; bh=mdtEj28dZXTNCegIMSj+ouANvKBQHRT8E7Az2+EHZig=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iHRDOX0bvlkaQF1Lb7Zyx/2i9jKy2mBZBTo5Lx/he6PB0ORu4yaEbPG747Rj0J2ge QgBUrs3SuJyfCQPEu08ZjscuGFkZdKYw8ewQXy5c7YE3HKqSQmqRXI2OUsx96skIe0 QIYCtU/4mVJEAhvYRFwdML028HVT7YbvUhrbQV50= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110992] [13/14 Regression] missed VRP optimization due to transformation of `a & -zero_one_valued_p` into `a * zero_one_valued_p` Date: Fri, 15 Sep 2023 03:19:01 +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: 14.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: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110992 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|14.0 |13.3 Summary|[14 Regression] Dead Code |[13/14 Regression] missed |Elimination Regression at |VRP optimization due to |-O3 since |transformation of `a & |r14-1654-g7ceed7e3e29 |-zero_one_valued_p` into `a | |* zero_one_valued_p` --- Comment #5 from Andrew Pinski --- Hmm, I think this is a ranger issue really. Take: ``` int f(unsigned b, short c) { int bt =3D b; int bt1 =3D bt; int t =3D bt1 & -(c!=3D0); // int t =3D bt1 * (c!=3D0); if (!t) return 0; foo(bt =3D=3D 0); return 0; } ``` That `bt =3D=3D 0` should be figured out that is 0 there. We could figure t= hat out in GCC 12 even. But in GCC 13+ we could not. That is traced back to r13-793-g8fb94fc6097c but really the ranger should figure out if you have a*b !=3D 0, then both a and b should be non-zero ... But currently that is not support .... It looks like we only handle `a & b` that way ...=