From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id BC0D2385840E for ; Mon, 29 Nov 2021 14:39:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC0D2385840E Received: by mail-pj1-x102f.google.com with SMTP id gx15-20020a17090b124f00b001a695f3734aso14453462pjb.0 for ; Mon, 29 Nov 2021 06:39:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=MMN0j68b6+o+3moBEpmC803/7a5iBN+zkBkREn/GjMU=; b=J5DzisLcNsCqqGF3RmPjGtpuJnXq+gTiMslxT92l7mqDZECO+B4LMNpjWm7FUTmLsw ODV7eHIpN4LikAz/nH9+tYj2ny6aTPf/gIa1LAXZw43BqMsc80a/rH1y9ceziLmMTDbM GHqINr/ibXyplollqkXvb18gL5u5pAXeX8H62Ol9FXuiPewW5mhEgg1ea07z90ZDUnBT HZ6d3avjJxjMY5YsoH3y0Ghmjq0weiMzGhP88c7NtWropYKB9Iyys/bCRWS2irRQ/O7P EKoT+dijzl49FzeryffqnqF8sbj3dkrwu1XMOwJZqeNZbCY+RnUWdhRRbdOs+yLU3he3 vPYg== X-Gm-Message-State: AOAM531CdlUuzQzRS3K/Om5e02S/IIdkPJW3Gvc0hZ+Ia14mP2aehcSP cmZl6QgoNRtbBOj1gb/6p4k= X-Google-Smtp-Source: ABdhPJw3u34eoqDubPv3e7E2m095XBp8jByaBLMz78fmWPZGd6K3IfbWo9atvFwbwdpHTvES9MJdMg== X-Received: by 2002:a17:90a:d192:: with SMTP id fu18mr38919315pjb.177.1638196785759; Mon, 29 Nov 2021 06:39:45 -0800 (PST) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id l1sm18542560pjh.28.2021.11.29.06.39.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 06:39:44 -0800 (PST) Message-ID: <48e8a1e2-940e-0dc7-999a-2f1c4f4d9b53@gmail.com> Date: Mon, 29 Nov 2021 07:39:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] Remove can_throw_non_call_exceptions special case from operator_div::wi_fold. Content-Language: en-US To: Aldy Hernandez , Richard Biener Cc: GCC patches References: <20211129140050.82907-1-aldyh@redhat.com> From: Jeff Law In-Reply-To: <20211129140050.82907-1-aldyh@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 14:39:48 -0000 On 11/29/2021 7:00 AM, Aldy Hernandez via Gcc-patches wrote: > As discussed in the PR. The code makes no difference, so whatever test > we added this special case for has been fixed or is being papered over. > I think we should fix any fall out upstream. > > [Unless Andrew can remember why we added this and it still applies.] > > Tested on x86-64 Linux. > > OK for trunk? > > PR 103451 > > gcc/ChangeLog: > > * range-op.cc (operator_div::wi_fold): Remove > can_throw_non_call_exceptions special case. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr103451.c: New test. I'll defer to Andrew, but it seems wrong to me.  The whole point is to set the result to varying so that we don't know the result and never remove the division which is critical for -fnon-call-exceptions. > --- > gcc/range-op.cc | 7 ------- > gcc/testsuite/gcc.dg/pr103451.c | 17 +++++++++++++++++ > 2 files changed, 17 insertions(+), 7 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/pr103451.c > > diff --git a/gcc/range-op.cc b/gcc/range-op.cc > index bbf2924f815..6fe5f1cb4e0 100644 > --- a/gcc/range-op.cc > +++ b/gcc/range-op.cc > @@ -1832,13 +1832,6 @@ operator_div::wi_fold (irange &r, tree type, > return; > } > > - // If flag_non_call_exceptions, we must not eliminate a division by zero. > - if (cfun->can_throw_non_call_exceptions) > - { > - r.set_varying (type); > - return; > - } > - > // If we're definitely dividing by zero, there's nothing to do. > if (wi_zero_p (type, divisor_min, divisor_max)) > { > diff --git a/gcc/testsuite/gcc.dg/pr103451.c b/gcc/testsuite/gcc.dg/pr103451.c > new file mode 100644 > index 00000000000..b83646d0b83 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr103451.c > @@ -0,0 +1,17 @@ > +// { dg-do compile } > +// { dg-options "-O2 -w" } ISTM that what you want to test for is that the division by zero remains in the IL for -fnon-call-exceptions. jeff