From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 79CD738582AA; Wed, 21 Sep 2022 11:33:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79CD738582AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663760037; bh=HrhS0Na3JiiqI4FTsncvunSTvkuk202KOw0B/6kuhKg=; h=From:To:Subject:Date:From; b=P+l2uHGkHZR92Kv33UdnvbSGGBv0Du3eU+ZMGK0FXhivBsJBY20cNY8GR2yCbXLfU QXl3CDyu1tJ/A3TyulBh2fCMK+6akADUUmRWq54PhCDpSLAaio4PyvXbDoNFwf4s0y rEZXCWqS1bKgBo401ev4O2Dl7dkWZW8i1D73U7GM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2761] [PR106967] Set known NANs to undefined for flag_finite_math_only. X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: 324fa420b66bc084dd5b20644c6ee7b35be90c00 X-Git-Newrev: dc829c7613ddf562d1aecaf22eda965e87108ac8 Message-Id: <20220921113357.79CD738582AA@sourceware.org> Date: Wed, 21 Sep 2022 11:33:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:dc829c7613ddf562d1aecaf22eda965e87108ac8 commit r13-2761-gdc829c7613ddf562d1aecaf22eda965e87108ac8 Author: Aldy Hernandez Date: Wed Sep 21 11:18:48 2022 +0200 [PR106967] Set known NANs to undefined for flag_finite_math_only. Explicit NANs in the IL can be treated as undefined for flag_finite_math_only. This causes all the right things to happen wrt threading, folding, etc. It also saves us special casing throughout. PR tree-optimization/106967 gcc/ChangeLog: * value-range.cc (frange::set): Set known NANs to undefined for flag_finite_math_only. Diff: --- gcc/value-range.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 505eb9211a7..7e8028eced2 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -313,8 +313,13 @@ frange::set (tree min, tree max, value_range_kind kind) gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min), TREE_REAL_CST_PTR (max))); tree type = TREE_TYPE (min); - bool sign = real_isneg (TREE_REAL_CST_PTR (min)); - set_nan (type, sign); + if (HONOR_NANS (type)) + { + bool sign = real_isneg (TREE_REAL_CST_PTR (min)); + set_nan (type, sign); + } + else + set_undefined (); return; }