From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB88E3858020; Wed, 22 Mar 2023 14:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB88E3858020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679493625; bh=Hbnm1OHxTIAHJ0IWMR8BvlgJyJCdXIY/fc8fVxQA1ug=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Bh323KJfCc/HaSqp8HJIhcQrzKB/cdDn4EhmOr9oNC7/ogjb4KtfeiioFojFDnHQH 5Kw1hRFAK3MdBuMR6iCozxSzbbGn23DUaC1RUGhsGbZj20VIkxWVJVsPxv7s7s8OXB siuWYGV82BnqqO3S0wBnKG84qxOVwXtH/uAMMzz4= From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109154] [13 regression] jump threading de-optimizes nested floating point comparisons Date: Wed, 22 Mar 2023 14:00: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: 13.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: 13.0 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=3D109154 --- Comment #9 from Andrew Macleod --- (In reply to Richard Biener from comment #7) > (In reply to Richard Biener from comment #6) > > ah, probably it's the missing CSE there: > >=20 > > : > > _1 =3D (float) l_10; > > _2 =3D _1 < 0.0; > > zone1_17 =3D (int) _2; > > if (_1 < 0.0) > >=20 > > we are not considering to replace the FP compare control if (_1 < 0.0) > > with an integer compare control if (_2 !=3D 0). Maybe we should do tha= t? >=20 That would resolve the issue from VRPs point of view. _2 has no involvement= in the condition, sonother _2 nor zone1_17 are considered direct exports.=20 We do however recognize that it can be recomputed as it depends on _1. I = have not yet had a chance to extend relations to recomputations, (its probably n= ot a win very often as we assume CSE takes care fo those things) I see we do make an attempt to recompute: 13 GORI recomputation attempt on edge 3->4 for _2 =3D _1 < 0.0; 14 GORI outgoing_edge for _1 on edge 3->4 15 GORI compute op 1 (_1) at if (_1 < 0.0) GORI LHS =3D[irange] _Bool [1, 1] GORI Computes _1 =3D [frange] float [-Inf, -0.0 (-0x0.0p+0)] intersect Known range : [frange] float VARYING +-NAN GORI TRUE : (15) produces (_1) [frange] float [-Inf, -0.0 (-0x0.0p+0)] GORI TRUE : (14) outgoing_edge (_1) [frange] float [-Inf, -0.0 (-0x0.0p+0)] GORI TRUE : (13) recomputation (_2) [irange] _Bool VARYING folding _2 using the true edge value: [-Inf, -0.0 (-0x0.0p+0)] < 0.0=20 is returning false, so we dont recognize that _2 is always true. I assume = this has something to do with the wonders of floating point and +/- 0:-)=