From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C7DE39ACCA9; Thu, 19 Nov 2020 23:20:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C7DE39ACCA9 From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/93917] VRP forgets range of value read from memory Date: Thu, 19 Nov 2020 23:20:25 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Thu, 19 Nov 2020 23:20:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93917 Andrew Macleod changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com --- Comment #2 from Andrew Macleod --- This seems to be a good place to bring up a question I have. What exactly do we want to with __builtin_unreachable across passes? Ranger was initially starting with the previously set globally known value,= and I had to disable it for pr61034.C Basically, the routine was pre-optimized and inlined, and inlining sets the global range based on the output from the optimizations, and when ranger removed the code with the unreachable in it, the testcase failed. so=20 void f(int n){ if(n<0)__builtin_unreachable(); } n has a global range of [0, +INF] Is that the basic point of this? Can we set the global range to that and eliminate the if? same thing for=20 if(*n<0)__builtin_unreachable(); I see: _1 =3D *n_3(D); if (_1 < 0) goto ; [INV] else goto ; [INV] 2->3 (T) _1 : int [-INF, -1] 2->4 (F) _1 : int [0, +INF] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 3 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D : __builtin_unreachable (); And we can know that _1 is [0, +INF] from then on.=20 Can we kill all these unreachables() the first time we see them if we set t= he range appropriately? If not, at what point do we want to kill them?=