From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 74466385624C; Fri, 16 Jun 2023 06:49:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74466385624C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686898163; bh=/xa6HBk8B4VohHF1yjpjD26xIUliIbHeIuoWhu71TJY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZsJIP2uYAJ6AdVECjn2Sf9HbLV8K3vzKflaiB/QJrEiCQEZSBUhjiwqXo9bsbe5t7 VRZHpoHUnas+1YzOE4RO8R0fyIsg7bBmqRIxCnFdm3LSo3X1tpFjZQzsehZvr9g278 axQqivFnwe5gJnJGL0zcbCLxwfQimE3n3ePZpRLw= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110269] [13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r13-4607-g2dc5d6b1e7e Date: Fri, 16 Jun 2023 06:49:22 +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: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status 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=3D110269 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #3 from Richard Biener --- It does handle GIMPLE_COND. What the change did was avoid using GENERIC fold_const and instead resort to match.pd only. I can't see how it arrived at folding it before. We (now) have Visiting PHI node: _15 =3D PHI Argument #0 (2 -> 7 executable) a.3_11 Value: CONSTANT a.3_11 Argument #1 (5 -> 7 executable) 6 Value: CONSTANT 6 PHI node value: VARYING Lattice value changed to VARYING. Adding SSA edges to worklist. so there's no nonzero bits info. The input to CCP2 is almost the same: int main () { - int D.2014; + int D.2786; int _1; int * * d.0_2; int * b.1_3; @@ -46,7 +46,7 @@ __assert_fail (); [local count: 1073458354]: - # RANGE ~[0, 0] + # RANGE [irange] int [-INF, -1][1, +INF] # _15 =3D PHI _20 =3D _15; _1 =3D _20; so it looks like range representation changes make a difference here? Ah, so match.pd lacks a simple (ne @0 integer_zerop) check using tree_single_nonzero_warnv_p. We have (simplify (cmp (convert? addr@0) integer_zerop) (if (tree_single_nonzero_warnv_p (@0, NULL)) { constant_boolean_node (cmp =3D=3D NE_EXPR, type); }))=