From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7E5F8385624A for ; Fri, 28 Oct 2022 08:24:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E5F8385624A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666945441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+aoy7kGUjeE7/+Tetg1p6kTmhPzeXMLpYQ24mfqkzeE=; b=HwXcWH0HKeR13C3Au0PO9X8AgInOz1XGInvvds56xRP6zKGovWTkrNr1c2Ku1CaVDe3Qo/ EoiQl/m+XxxqMBV5Lj95SDj6mFjKTbnF4v6iYwfxAshf672E74Ik6smS+lFyXxOr91liM3 Xkoj1wobazB4IHRMHCyW0UhmgJxjRrM= Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-588-0uvZwUcEMPu0Vq8QRLUKMQ-1; Fri, 28 Oct 2022 04:23:55 -0400 X-MC-Unique: 0uvZwUcEMPu0Vq8QRLUKMQ-1 Received: by mail-yb1-f200.google.com with SMTP id q62-20020a25d941000000b006cac1a4000cso3937643ybg.14 for ; Fri, 28 Oct 2022 01:23:55 -0700 (PDT) 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=+aoy7kGUjeE7/+Tetg1p6kTmhPzeXMLpYQ24mfqkzeE=; b=w+rNLGJKXFj6qj3dhwJcUNVmxUlWgzST01f2j/T13VA2EDduuRa1TbQRFzkQrj+syR cTIAfWO6akJmq3nRfaqSghfhaPcf0NDjJL/Pm+n4D3LYWFvu2ls5D44L952RKKecKpjb BwO5E0Zw6hHQCeRK/Xh/xbY28f21XtbXXGR0MFbuaxwaeKFNL+cYO8aNk6LHuWrXlQ4p Mz6o24+DlZb/bv/RPGK+erkIrXm/I/s9uNdMtHP4TP0bg/gFg8eex8mBe8wU6SuhBSyJ /H5iRvoyqSzNhrVxSv41r5U2fFZ23/3SPq/8uBEhkkKPl2IAcx7MpvdatlRDxHjlD8k8 aEHg== X-Gm-Message-State: ACrzQf2QNiWRtbI1QbEEpHn619NP1h5HsquXgZwtTA23juTI/MoIjY9V 1uBptsaDo2KvG4l4R5FKL0WA7nJTcpLYjJVenGwg/vU9V44zahcj/jF0CwBW52qXsXVr/CN+f2c F3l64Wc5hisqNWQRe7nkUvA3j86d96+gsRw== X-Received: by 2002:a81:1c49:0:b0:368:8355:3e98 with SMTP id c70-20020a811c49000000b0036883553e98mr40184859ywc.154.1666945434722; Fri, 28 Oct 2022 01:23:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KyR3SnkGijb3Tki9f3J75CvNJtXUnw0gF08kQlLKAsO5GiO+lbQcunN+ed1eCST8jQ5UTmBrm1Sj4I69YoAY= X-Received: by 2002:a81:1c49:0:b0:368:8355:3e98 with SMTP id c70-20020a811c49000000b0036883553e98mr40184842ywc.154.1666945434452; Fri, 28 Oct 2022 01:23:54 -0700 (PDT) MIME-Version: 1.0 References: <20221025210140.125230-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 28 Oct 2022 10:23:44 +0200 Message-ID: Subject: Re: [PATCH] [PR tree-optimization/107394] Canonicalize global franges as they are read back. To: Richard Biener Cc: Jeff Law , Jakub Jelinek , GCC patches , "MacLeod, Andrew" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000007b16b105ec13fa3a" X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: --0000000000007b16b105ec13fa3a Content-Type: text/plain; charset="UTF-8" On Fri, Oct 28, 2022, 08:49 Richard Biener wrote: > On Fri, Oct 28, 2022 at 12:45 AM Jeff Law wrote: > > > > > > On 10/25/22 15:01, Aldy Hernandez via Gcc-patches wrote: > > > [Richi/Jakub/FP experts, does this sound like the right solution, or > am I > > > missing some subtle IPA/inlining issue?] > > > > > > The problem here is that we're inlining a global range with NANs into > > > a function that has been tagged with __attribute__((optimize > > > ("-ffinite-math-only"))). As the global range is copied from > > > SSA_NAME_RANGE_INFO, its NAN bits are copied, which then cause > > > frange::verify_range() to fail a sanity check making sure no NANs > > > creep in when !HONOR_NANS. > > > > > > I think what we should do is nuke the NAN bits as we're restoring the > > > global range. For that matter, if we use the frange constructor, > > > everything except that NAN sign will be done automatically, including > > > dropping INFs to the min/max representable range when appropriate. > > > > > > PR tree-optimization/107394 > > > > > > gcc/ChangeLog: > > > > > > * value-range-storage.cc (frange_storage_slot::get_frange): Use > > > frange constructor. > > > > > > gcc/testsuite/ChangeLog: > > > > > > * gcc.dg/tree-ssa/pr107394.c: New test. > > > > The other approach would be to disabling inlining in this case due to an > > unsafe attribute mismatch, but we're not currently doing much sanity > > checking in this space and it might be a huge can of worms. I'm > > inclined to ACK, but give Jakub and Richi until Monday to chime in first. > > We are actually quite careful in this regard but maybe our reasoning > is wrong. We are allowing inlining of -fno-finite-math-only into > -ffinite-math-only code but not the other way around. > > On the actual patch I think that ranges with Inf/NaNs should be always > treated as "valid", the optimization to trim them with certain options > is optimization and thus optional. So IMHO having verify_range ICE > on NaNs isn't correct? > That was my gut feeling as well, but the assert has caught real issues such as this one. Also, in your example down thread, we would drop the explicit NAN to UNDEFINED if expressed as a range (as agreed earlier this cycle). So we won't ICE...since a range with NAN will never get built. The assert is there to keep NANs from sneaking in. However, if you still think it's incorrect I'm happy to remove it. > That said, the patch is in line with what we do elsewhere at the moment, > so I guess OK. > Thanks. Aldy > Richard. > > > > > jeff > > > > --0000000000007b16b105ec13fa3a--