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.129.124]) by sourceware.org (Postfix) with ESMTPS id 881033858C2C for ; Tue, 30 Nov 2021 09:04:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 881033858C2C Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-301-OluWcC_-PkOhKDFm1LsOww-1; Tue, 30 Nov 2021 04:04:28 -0500 X-MC-Unique: OluWcC_-PkOhKDFm1LsOww-1 Received: by mail-oi1-f199.google.com with SMTP id k124-20020acaba82000000b002a7401b177cso13433750oif.8 for ; Tue, 30 Nov 2021 01:04:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fzadC1HFsDyrxk3u302x7CK/Tbts0MAemcwtE+dXF2o=; b=ChFqmgFydfCVrfT1FVNRoaiUVMschXx2R7tvX35DQGR71Ifqjhq1pQ04HsMOQrKZKV /pz9NeMuhI2huoKmRzAzVRZkTK1GyDwoRR808bG8R6q3/CLHpLF72qyI54S1v0HXtnU5 pM15db1MOov2HTYakpf11qYdTnSNJQMRjTVZwFh2xhMJORHtdHvImnBtjw9F+F746RJP CJMjyrrA/sqPxvLFmZ37sY+YWj9BeXm5IVOA7fTe6BT1FafmFC2OUjfXE77Z+BuhGXDq E6R38BqAB/ma5ww/ZkLy+xI07aLlohshH18JFobkAJwPkt/+ku1QncbBfd61GeiiZZcl 6jFw== X-Gm-Message-State: AOAM530iX0mNGQx0NJxRkgbOcfYUhfFjwsLKIxqv1uFtbTxwN6D+E8oH 5fuWoTZx7o57wz/GubhfYWIq9is0FZOq2LpsPTgVlMtsTW7sAAa9iMOwvHR8YuGG1oBUVQmZgsc MjbJoFVkOF0/VrgDMhXuwm+nHf0Mvl7NZdA== X-Received: by 2002:a4a:3e85:: with SMTP id t127mr35215283oot.78.1638263067932; Tue, 30 Nov 2021 01:04:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaUN06JTwoqDgBCMly7ciWuj3NSpLgeuTkYWk3N3WK9yQCN9HLJzpfhnEIr3VwvOSckHQ9qjaFIATSE4RqY9Q= X-Received: by 2002:a4a:3e85:: with SMTP id t127mr35215271oot.78.1638263067690; Tue, 30 Nov 2021 01:04:27 -0800 (PST) MIME-Version: 1.0 References: <20211129140050.82907-1-aldyh@redhat.com> <48e8a1e2-940e-0dc7-999a-2f1c4f4d9b53@gmail.com> In-Reply-To: From: Aldy Hernandez Date: Tue, 30 Nov 2021 10:04:16 +0100 Message-ID: Subject: Re: [PATCH] Remove can_throw_non_call_exceptions special case from operator_div::wi_fold. To: Richard Biener Cc: Jeff Law , GCC patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Tue, 30 Nov 2021 09:04:33 -0000 Will adjust, re-test and commit. Thanks. Aldy On Tue, Nov 30, 2021 at 10:00 AM Richard Biener wrote: > > On Tue, Nov 30, 2021 at 9:51 AM Aldy Hernandez wrote: > > > > On Tue, Nov 30, 2021 at 8:37 AM Richard Biener > > wrote: > > > > > > On Mon, Nov 29, 2021 at 4:24 PM Aldy Hernandez wrote: > > > > > > > > On Mon, Nov 29, 2021 at 3:48 PM Richard Biener > > > > wrote: > > > > > > > > > > On Mon, Nov 29, 2021 at 3:39 PM Jeff Law wrote: > > > > > > > > > > > > > > > > > > > > > > > > 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. > > > > > > > > > > But that has nothing to do with computing the value range for > > > > > the result which is only accessible when the stmt does _not_ throw ... > > > > > > > > > > That is, if we compute non-VARYING here and because of that > > > > > remove the stmt then _that's_ the place to fix (IMO) > > > > > > > > Ughh, I think you're both right. > > > > > > > > We should fix this upstream AND we should test for the presence of the > > > > division by 0 in the optimized dump. > > > > > > > > Of course doing both opens a can of worms. The division by zero can > > > > be cleaned up by (at least) DCE, DSE, and the code sinking passes. > > > > I've fixed all 3 in the attached (untested) patch. Dunno what y'all > > > > want to do at this point. > > > > > > I think you need to add -fno-delete-dead-exceptions to the testcase. > > > The sinking > > > bug looks real, but just > > > > > > && (cfun->can_delete_dead_exceptions > > > || !stmt_could_throw_p (cfun, stmt)) > > > > > > is needed there. That change is OK. > > > > Did you mean the entire patch (as attached) is OK, or just the sink part? > > The DCE and DSE parts are wrong and not needed. The remaining pieces > are OK. > > Thanks, > Richard. > > > Thanks. > > Aldy >