From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 745493858D3C; Thu, 10 Nov 2022 12:47:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 745493858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668084445; bh=rLt9M8y81Z3REyExhUEWlK+zaSSr90Gh6FaPXVAEX7Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JY0k3ACE/8NP4tw2J3kQIb/UsqIs9rRAb4OZIp21mf+n5riigKCNVUG8lvPkBP1dd sLrKYp+N9mbNJ4gRpuZLsb2h7Vt11PVsbfqtaUy9Qdm4y/fjCtv2DsSwnubjWWwYYk WlBFGe1fSNjpVajjFiJL7+Crm9xPDDODcCeemK4w= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107569] [13 Regression] Failure to optimize std::isfinite since r13-3596 Date: Thu, 10 Nov 2022 12:47: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: aldyh at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 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=3D107569 --- Comment #27 from Aldy Hernandez --- (In reply to Jakub Jelinek from comment #26) > (In reply to Aldy Hernandez from comment #24) > > If you single step from there on, we run into: > >=20 > > if (gimple_stmt_nonnegative_warnv_p (call, &strict_overflow_p)) > > r.set_nonnegative (type); > > else if (gimple_call_nonnull_result_p (call) > > || gimple_call_nonnull_arg (call)) > > r.set_nonzero (type); > > else > > r.set_varying (type); > >=20 > > IIRC, we had some discussion upstream about the meaning of set_nonnegat= ive, > > and we all agreed that nuking -NAN was the right thing. Neat, huh? :) >=20 > Is this done only for statements for which there isn't a ranges handler? > If so, given the IEEE 754 non-guarantee of NAN signs except for copy, abs, > copysign and negate I'd say that we should have a ranges handler for all > those ops and for anything else assume NAN sign is VARYING, including the > above spot. We're doing this for all GIMPLE_CALL's, so copy, abs, copysign are handled separately, either as builtins or in the IL directly (i.e. not calls). Hmm= m, maybe it's time to revisit what frange::set_nnonnegative() means (again). Lemme think about this...there are very few set_nonnegative() calls in rang= er.=20 It should be easy to contain. > As for signed zeros in -fsigned-zeros (default) mode, wonder if we e.g. d= on't > say sqrt is nonnegative (even when sqrt (-0.0) is -0.0). It seems tree_call_nonnegative_warnv_p is already doing the right thing for sqrt? CASE_CFN_SQRT: CASE_CFN_SQRT_FN: /* sqrt(-0.0) is -0.0. */ if (!HONOR_SIGNED_ZEROS (type)) return true; return RECURSE (arg0);=