From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id A59C43858D28 for ; Thu, 26 Jan 2023 07:09:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A59C43858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x135.google.com with SMTP id g13so1701424lfv.7 for ; Wed, 25 Jan 2023 23:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9Nk2uw476QcRreZaQGSs+eqb40JnzoeP1X00BNjgADU=; b=OAzSZXMzXYpQkUSnju94hNCe6VuP3tYvT82RGUG/DqENIty6tm5GZMfNe6vI4Rn81h f1byl7d2JKJ2KFjh8XAccq6/RP6sEjeU3XOhOIDPpnmzVwVUKY12kRCNJXV9tuEp+n35 YmN6a+Xb2fa2220kkMoIlXYNaVH+83AaU/oVHSFGEaAoPoMkhw1HrR8buR+FvoQ2vXdl OT7psrH6WWbC/v5eMXh8+FZ8i/W++xzpFLPklcpuUCnKh+SJS8bE++9pS1FWJyjJfs6j oyejnJlb+ukBBEsQpoyNI9CSKGd5V1QZ/SX9YUXVU1FgWYLvQ2sTR6AGIcdKfc1C80Xn 5xsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9Nk2uw476QcRreZaQGSs+eqb40JnzoeP1X00BNjgADU=; b=dRRzVvJFiQrKSJfTB90yEySnrMUriCb4FQkLihQUWL9sONquP6icJojnNus3PjuBQq ncHl/oGc66iSdbFV5dex9lUi28WrOq2yXN9+LHNys/VWWccEKDpe14tTkXtXbXAcfWjD A3otL/vpVg9A/EZ+gbUkuGrSvWLsTqk5X6TzWbtQ1t58gN8z09Tlmv1icibfKwJOVJoy /dY9F9+ikuXBg+JT34WrVe+y2Q5RzkZxHQgvgTqf8EcQOqs7FTEB1/Nd6zf/w8sEwQYf 58rA73G9X/dFLdmGa/OvCzAzh+jSUm3CJviJ8W+aMU8hT+C2S83X4aWGUkJCXbGPD75L atgA== X-Gm-Message-State: AFqh2ko7nWOeKjg7cJtXt5TmyONg/7uU0N2HcFARQDSftJe2VrXQvTEo d9YTdD/r8N/w0vY/iGxNV8QUusRJOJUzHHXoWwk= X-Google-Smtp-Source: AMrXdXufetxLADcYuqmkAR6md1oTMDhicXhUjb+MCf48nwb2FXA2zMw6z+nR2r7LuuvJv4Iw8UpyuuS+ewZadu1mP1k= X-Received: by 2002:ac2:53ae:0:b0:4cc:59f7:4453 with SMTP id j14-20020ac253ae000000b004cc59f74453mr3120759lfh.323.1674716985705; Wed, 25 Jan 2023 23:09:45 -0800 (PST) MIME-Version: 1.0 References: <0780922f-99b5-96fc-b921-9e00652f9741@redhat.com> In-Reply-To: <0780922f-99b5-96fc-b921-9e00652f9741@redhat.com> From: Richard Biener Date: Thu, 26 Jan 2023 08:09:33 +0100 Message-ID: Subject: Re: [PATCH] PR tree-optimization/108447 - Do not try to logical fold floating point relations. To: Andrew MacLeod Cc: gcc-patches , Jakub Jelinek , "hernandez, aldy" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jan 25, 2023 at 7:05 PM Andrew MacLeod wrote: > > This boils down to a single place where we are trying to do things with > relations in ranger that are simply not safe when we need to honor NANs. > > I think we can avoid all the other shuffling of relations, and simply > not perform this optimization when it comes to floats. > > The case the routine handles is: > > c_2 = a_6 > b_7 > c_3 = a_6 < b_7 > c_4 = c_2 && c_3 > > c_2 and c_3 can never be true at the same time, Therefore c_4 can always > resolve to false based purely on the relations. > > > Range-ops is unable to do this optimization directly as it requires > examining things from outside the statement, and is not easily > communicated a simple relation to operator_logical_and. > > This routine proceeds to look at the definitions of c_2 and c_3, tries > to determine if there are common operands, and queries for any relations > between them. If it turns out there is something, depending on whether > its && or || , we use intersection or union to determine if the result > of the logical operation can be folded. If HONOR_NANS is true for the > float type, then we cannot do this optimization, and bail early. > > At this point I do not think we need to do any of the other things > proposed to relations, so we don't need either of the other 2 patches > this release. > > Bootstraps on x86_64-pc-linux-gnu with no regressions. OK for trunk? + if (HONOR_NANS (TREE_TYPE (ssa1_dep1))) + return; would that rather be !(range-includes-nan (ssa1_dep1) || range-includes-nan (ssa1_dep2) || ..)? That said, if the other 2 patches fix some latent issues in the new frange code I'd rather have them fixed. Richard. > > Andrew