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: 1663168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=j+VjmUg4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LyB0k4PDJz9sB4 for ; Wed, 3 Aug 2022 09:24:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E831B3858033 for ; Tue, 2 Aug 2022 23:24:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E831B3858033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659482689; bh=jiN1VFDdfSQF151Z2ca/C15apH8cRguCVzIUphCdqN8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=j+VjmUg4Pe4Hg6lmDcNjB7sLENZUHQ5b1mRg9AFl+fw+FSTbQo1TD/E1j1bVhjFAq ZorBgMG7iREDgXmOAsFPtY1yXdWBpncchSsUomEYIGylD5mpL63/c9YF7HHidNrNpm 48N+FqjiCKoPDa3zUW9+Oi5qHcQ6rFn2kbNw7uzc= 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-Google-Smtp-Source: AA6agR4vQR/5dCWSov7ewkE9W1onKSEKBbKC7M3OJHLbaOlvEVNiDZpYe6NyDFWAtRgRj+CrplTnEA== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 (); +} +