From patchwork Tue Aug 2 23:24:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp4020pxt; Tue, 2 Aug 2022 16:25:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t8MrE5ZI5G1wp/4DeiY5CeY4KMnue0iwPrYzD8Oq44Nc312QuTStkyNMifDMzRENJq0Kmy X-Received: by 2002:a17:907:75e9:b0:72b:2ddb:41fe with SMTP id jz9-20020a17090775e900b0072b2ddb41femr17994732ejc.329.1659482720838; Tue, 02 Aug 2022 16:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659482720; cv=none; d=google.com; s=arc-20160816; b=fRpUTWEYdZ5u8KTygSx9HGbW7AhGNQXz7RKbc0eTWKjeJ58et6NSdLiOaodsG9wAUb Rg/0K1GujXcjicenGpjLwVlxgzW7aNiyVk2uQ6A+6eBBB9AKqdn5IItq0QBt7iMe8kRj CzHryEek9qFV3V58/kEXcLNFogdkTrsICDSzsb+Xm+SukwktvsnmQ377lbNZ0TI64icW +p6zjGvcpB6FYd1uo82g9SrZJhcKkl2Um5BanefN4bRU3OqK9rmRm3+qqvO2do1fjd9n LU8khAKSP2AKTba5v/AAu5zPRVcVyerTCuaRhWOfQmQ84yEvfNrBcO2VRJ2Sma2lWsjp r6zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:content-language :subject:to:user-agent:mime-version:date:message-id:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=jiN1VFDdfSQF151Z2ca/C15apH8cRguCVzIUphCdqN8=; b=EbKPSGaKD067++Q/wgUmz2onRSkTniCn1f/r2gCZ1rxm8lscKNdXUud+xIcKKK5KaU fELDNk/DVTqRZUpKL7FB6ysjHlcxrDZ/7WA2vko9u0pHBZnXPFJK2u/cpdEoTTvkrCT6 d+AHtm2+jGQpRy864DqDQDB4ZfWI2fqKH2LjkjKMyGmIcyY/0gsQBrrG7GGwEbglgHSX +l58pmZYe3RV7UXaHZleS6ZFW7FlMjOYl/ijlxXrIARELf1xeSfw9fvzTlNQbpZrmSQN uGoi5JiZKI4bGwe56Z/DHTbSD/VvDH5MJqHqMLj1yh7zq++IX7BVSASVdIK6a9o/keCI 6wvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="DmNK5v/5"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o16-20020aa7dd50000000b0043c762f29dfsi11006291edw.524.2022.08.02.16.25.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 16:25:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="DmNK5v/5"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FEE1385AE66 for ; Tue, 2 Aug 2022 23:25:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FEE1385AE66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659482713; bh=jiN1VFDdfSQF151Z2ca/C15apH8cRguCVzIUphCdqN8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=DmNK5v/5RsJdNbnyk0r0aaVIU/rITJJIeH6tHgVkb1ZDzZAH8AHt7+Op/RZiZGVq+ G6oEMDIBMSNhwejWlXlxTLwENni8jb421v+LyHOzLsDgVunRVO9iu3V4X6RcSoe2W7 8ClFURXgPKZFWn1X6vdJAc0G0FF0AZ6BPh1X40tE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 D3BE53858C27 for ; Tue, 2 Aug 2022 23:24:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3BE53858C27 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-38-tvt1wdaRPE-GLcdrATCwOw-1; Tue, 02 Aug 2022 19:24:28 -0400 X-MC-Unique: tvt1wdaRPE-GLcdrATCwOw-1 Received: by mail-qk1-f198.google.com with SMTP id x22-20020a05620a259600b006b552a69231so12530876qko.18 for ; Tue, 02 Aug 2022 16:24:28 -0700 (PDT) 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 :content-language:to:cc:from:subject; bh=oKTfTlmbZaKAfv4w7voHWJOcm/2kqyxRWopGwULDEug=; b=exRK9kUbJ0+FbtDXSY2WqebGb5jbW/J8S6qEGxdDSnhzVsOUn0aghgJgLfEjlwfNdm FJP6CzfoqKx74miJlNwNvKo7FDlk8ShakJ69yYyYPbYqXWwifPiS0ruqP1tPjxFcz0/Z jpWhoKPkXq6HfjaCideA00GQsIyk+soznshroP9ZmRnA27KTcVZFGQhDUaX3137VMXRk nax6svAwGOjnmBBM7sETGKPhRYPrm5QyJQzsiTQ7hLFs/8Li1evK3I4XfI3w1izkV3qq eGU86+JjkHGq9zMxFewR4YtuzFybAxpbPgNrxuvOBrwT44H1tr7ywMHYvhFFY2utizFV YpPg== X-Gm-Message-State: ACgBeo0DF1YXvH2vPZbVZTrHn6osXthSiwqMH1A4ONeD7wulXUtQLQP9 u/8K76vaEDq9Ovqux9uISHhCUMGoQtFRrLOKYlFdq6VfpVoRJ14PfoFur+gDQfF3BwrJNbhQe8U l4UC6XmOvDRHB7ux2tmzc6SVrN2T/o2MITvZFTLQTJZl+dyKdisjSgX4gL6Mc44LvtW0+Qg== X-Received: by 2002:a05:6214:d46:b0:477:1218:f522 with SMTP id 6-20020a0562140d4600b004771218f522mr318115qvr.6.1659482667876; Tue, 02 Aug 2022 16:24:27 -0700 (PDT) X-Received: by 2002:a05:6214:d46:b0:477:1218:f522 with SMTP id 6-20020a0562140d4600b004771218f522mr318103qvr.6.1659482667658; Tue, 02 Aug 2022 16:24:27 -0700 (PDT) Received: from [192.168.0.135] ([104.219.120.152]) by smtp.gmail.com with ESMTPSA id do54-20020a05620a2b3600b006b5e1aeb777sm1877430qkb.43.2022.08.02.16.24.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 16:24:26 -0700 (PDT) Message-ID: <25f51fd0-41a6-a4c8-29ac-d0d7f8918ffe@redhat.com> Date: Tue, 2 Aug 2022 19:24:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: gcc-patches Subject: [COMMITTED] tree-optimization/106510 - Do not register edges for statements not understood. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 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-Patchwork-Original-From: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1740093753529023888?= X-GMAIL-MSGID: =?utf-8?q?1740093753529023888?= When only interger ranges were supported, we knew all gimple COND statements were supported.  this is no longer true with float support, so gracefully do nothing when they are encountered. You can choose to remove the "unsupported relational" range-ops if you so wish.  we shouldn't need those., Bootstrapped on 86_64-pc-linux-gnu with no regressions.  pushed. Andrew commit 70daecc03235aa7187b03681cebed6e04b32678e Author: Andrew MacLeod Date: Tue Aug 2 17:31:37 2022 -0400 Do not register edges for statements not understood. Previously, all gimple_cond types were undserstoof, with float values, this is no longer true. We should gracefully do nothing if the gcond type is not supported. PR tree-optimization/106510 gcc/ * gimple-range-fold.cc (fur_source::register_outgoing_edges): Check for unsupported statements early. gcc/testsuite * gcc.dg/pr106510.c: New. diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 923094abd62..689d8279627 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -1496,6 +1496,10 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge tree name; basic_block bb = gimple_bb (s); + range_op_handler handler (s); + if (!handler) + return; + if (e0) { // If this edge is never taken, ignore it. @@ -1524,8 +1528,6 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge tree ssa2 = gimple_range_ssa_p (gimple_range_operand2 (s)); if (ssa1 && ssa2) { - range_op_handler handler (s); - gcc_checking_assert (handler); if (e0) { relation_kind relation = handler.op1_op2_relation (e0_range); diff --git a/gcc/testsuite/gcc.dg/pr106510.c b/gcc/testsuite/gcc.dg/pr106510.c new file mode 100644 index 00000000000..24e91123f63 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr106510.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void foo (); +void ine_ok() { + float y, x; + if (x < y || x > y || y) + foo (); +} +