From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 25B3C3858417 for ; Fri, 28 Oct 2022 06:48:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 25B3C3858417 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-ej1-x62e.google.com with SMTP id 13so10822519ejn.3 for ; Thu, 27 Oct 2022 23:48:49 -0700 (PDT) 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=rU5wMi1xNnlJnbygo5+KEST19SEkCv2de451nySG1SE=; b=jOzAVQN26EEe7uHcYOz5x0n6D2fhmtg0I8kkaHLW8zhWqwyZl7gPyG4JptEILdNjGY zhsSRM+Wk93GRM+l29Hcgx8OG1Z9Wbbx/lxUoa23aiJyxvFRs2/q9ZLBmJnGcB7FDCe9 JXiTIAHYRD9j+amhFkMFKb9phhXp+v8Vk6WZW5kgPhABRUkz0+8h7O9lQ17sGAUr4XaO Q0fKfvHcDVbcGAv3hCv2989HWPffHL7b+95pg1JPdnL7uNkZtDoObAqnTr46Sc4UabPY sKWaoDw28HR5vytAQpVynZZDB+Bj0RwtWN1KTD2RHMgcmC3qVpGTUI+/zsA9w/+UYtxg 7kbQ== 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=rU5wMi1xNnlJnbygo5+KEST19SEkCv2de451nySG1SE=; b=I/qo1AZ3iU9X1YRcbS1geX/x79FxEzTWm8J/IaWZdvLkTnl5Bp4ok0WZdXd+4k4+KT PujP0d0bmJl9oPPnK0VA4Z8rS6DQYihFJNDR8pjLlPGTuI/mhZeZpFN/qgMMUyjPYEu3 dXM/oSJE9a5iyOSAJ2FvtRjt+otxIYC5ca7txfE0yG5hma3cK5Qs6PSfXIu4F1KkB4PB FMnIAwaHjy+dExtAB9YNBH/NnwJgTYBAlUvJHjaNDh6VpNGqmsc6oaFV2VadSnqHzMxw Pu5UFbIGFVytO6dLaToPBvfOjS7dLdks0wCYIhwckATXrcfnWUlZponoxt+WucILVUdw /Llg== X-Gm-Message-State: ACrzQf2UClCOOIx4lA1aXpW/MXzErwLJuYb0JLVXlquzIJOvBIPHePiD 7ePjuXaq9PatE6tlLOfyVQn3UPUBqMab8GcPsXI= X-Google-Smtp-Source: AMsMyM4eFH86FMQZ30bpMJTuDqGSj1xKeMsXTGJlQPtstxXicn/su5ueKcK+YTL928zyTHDnOQtI3X/4QZ9NqB7jMqU= X-Received: by 2002:a17:906:8b81:b0:7ad:93d1:5eae with SMTP id nr1-20020a1709068b8100b007ad93d15eaemr5040435ejc.29.1666939727812; Thu, 27 Oct 2022 23:48:47 -0700 (PDT) MIME-Version: 1.0 References: <20221025210140.125230-1-aldyh@redhat.com> In-Reply-To: From: Richard Biener Date: Fri, 28 Oct 2022 08:48:35 +0200 Message-ID: Subject: Re: [PATCH] [PR tree-optimization/107394] Canonicalize global franges as they are read back. To: Jeff Law Cc: Aldy Hernandez , Jakub Jelinek , GCC patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 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 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 said, the patch is in line with what we do elsewhere at the moment, so I guess OK. Richard. > > jeff >