From patchwork Tue Aug 4 06:34:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340687 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=pn1/3GUc; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ4R3KTDz9sRR for ; Tue, 4 Aug 2020 16:35:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2AD6A3844045; Tue, 4 Aug 2020 06:35:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AD6A3844045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596522949; bh=qtrrrO9I5x1Qhg2aOh8ZhQJRZjqIE1vQT1+BJN3o2ss=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=pn1/3GUc1OW5fNKQpK7o7IspRgPfo2yNXUUayPUfTuPawT8RoJX3RxjEDySRPSuIp 5TMbPEq0XmkoJuaWerzD71agVufVtUBXkk3Kc+Qhiy60afJ/WgxdI583Ppo5Un5Ged rOPG8vdWerxOcfxcK0sJm8Ynu70aCh3zValF7pNA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id C152B3844042 for ; Tue, 4 Aug 2020 06:35:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C152B3844042 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-5VtBwi8dNgKn3jir9HKvnA-1; Tue, 04 Aug 2020 02:35:45 -0400 X-MC-Unique: 5VtBwi8dNgKn3jir9HKvnA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B38E10059AA for ; Tue, 4 Aug 2020 06:35:44 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE3A127CD0; Tue, 4 Aug 2020 06:35:43 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746ZfGp518025 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:35:42 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746ZfGW518024; Tue, 4 Aug 2020 08:35:41 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 1/8] Remove ad-hoc range canonicalization from determine_block_size. Date: Tue, 4 Aug 2020 08:34:37 +0200 Message-Id: <20200804063441.517123-2-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.1 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, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Anti ranges of ~[MIN,X] are automatically canonicalized to [X+1,MAX], at creation time. There is no need to handle them specially. Tested by adding a gcc_unreachable and bootstrapping/testing. gcc/ChangeLog: * builtins.c (determine_block_size): Remove ad-hoc range canonicalization. --- gcc/builtins.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/gcc/builtins.c b/gcc/builtins.c index 228db78f32b..beb56e06d8a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3287,12 +3287,6 @@ determine_block_size (tree len, rtx len_rtx, } else if (range_type == VR_ANTI_RANGE) { - /* Anti range 0...N lets us to determine minimal size to N+1. */ - if (min == 0) - { - if (wi::fits_uhwi_p (max) && max.to_uhwi () + 1 != 0) - *min_size = max.to_uhwi () + 1; - } /* Code like int n; @@ -3302,7 +3296,7 @@ determine_block_size (tree len, rtx len_rtx, Produce anti range allowing negative values of N. We still can use the information and make a guess that N is not negative. */ - else if (!wi::leu_p (max, 1 << 30) && wi::fits_uhwi_p (min)) + if (!wi::leu_p (max, 1 << 30) && wi::fits_uhwi_p (min)) *probable_max_size = min.to_uhwi () - 1; } } From patchwork Tue Aug 4 06:34:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340688 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=G+SE5wsI; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ4f1rzRz9sRR for ; Tue, 4 Aug 2020 16:36:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2CFD4386EC79; Tue, 4 Aug 2020 06:35:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CFD4386EC79 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596522958; bh=HRfofiZB+yRhuhRWOz72rLjiOJR579SQkjg5ySEK4Go=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=G+SE5wsIHymWfWHiWK2aRpOM+GTC64L0Ie2J715OEhZCdrlqDfmRAL4A/Mk4tp/VG 14gZ94FxUTJ7IledqMzIbgGMV0JBv74WbX2YIEEYmXGSaxn0ly2Lrp4RysMe3gN1AX d/mTMUV6KQJyd9pIWeS0bV4HXmrWIjK0/qXLgw7A= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 92261386EC42 for ; Tue, 4 Aug 2020 06:35:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 92261386EC42 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-j4qgd4n6PWCYXMlgttSUrQ-1; Tue, 04 Aug 2020 02:35:54 -0400 X-MC-Unique: j4qgd4n6PWCYXMlgttSUrQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4AB2106B242 for ; Tue, 4 Aug 2020 06:35:53 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7793972E4F; Tue, 4 Aug 2020 06:35:53 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746Zpto518030 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:35:51 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746Zpx9518029; Tue, 4 Aug 2020 08:35:51 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 2/8] Adjust expr_not_equal_to to use irange API. Date: Tue, 4 Aug 2020 08:34:39 +0200 Message-Id: <20200804063441.517123-3-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.1 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * fold-const.c (expr_not_equal_to): Adjust for irange API. --- gcc/fold-const.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1324a194995..5d27927f6bf 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10194,8 +10194,7 @@ tree_expr_nonzero_p (tree t) bool expr_not_equal_to (tree t, const wide_int &w) { - wide_int min, max, nz; - value_range_kind rtype; + value_range vr; switch (TREE_CODE (t)) { case INTEGER_CST: @@ -10204,17 +10203,9 @@ expr_not_equal_to (tree t, const wide_int &w) case SSA_NAME: if (!INTEGRAL_TYPE_P (TREE_TYPE (t))) return false; - rtype = get_range_info (t, &min, &max); - if (rtype == VR_RANGE) - { - if (wi::lt_p (max, w, TYPE_SIGN (TREE_TYPE (t)))) - return true; - if (wi::lt_p (w, min, TYPE_SIGN (TREE_TYPE (t)))) - return true; - } - else if (rtype == VR_ANTI_RANGE - && wi::le_p (min, w, TYPE_SIGN (TREE_TYPE (t))) - && wi::le_p (w, max, TYPE_SIGN (TREE_TYPE (t)))) + get_range_info (t, vr); + if (!vr.undefined_p () + && !vr.contains_p (wide_int_to_tree (TREE_TYPE (t), w))) return true; /* If T has some known zero bits and W has any of those bits set, then T is known not to be equal to W. */ From patchwork Tue Aug 4 06:34:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340689 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=YfZlAms/; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ4p1McKz9sSt for ; Tue, 4 Aug 2020 16:36:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D4DC1386EC42; Tue, 4 Aug 2020 06:36:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4DC1386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596522967; bh=2MSYy1By5qNPw+l1W1RFAdWP22tdYLU5zIdFVwhppV0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YfZlAms/z1ZVR0SbpXR+QUk6Y9y20VqoSorUnRAxfb1ukWGN7Z1XvFoGnSmOVR5JE AFx6Crw9ENnIWPl+2OV3HsqHIpM02gXEJv3NleHJGni5wYnW/vxEhpRe259CRB9TtW lJ6WnKLhQuiKBP7nUwfccpSUCuCMBsq9Vaxi2BOE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 879EE3844042 for ; Tue, 4 Aug 2020 06:36:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 879EE3844042 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-Y-Qoos19O3KzT4aT7SLUUw-1; Tue, 04 Aug 2020 02:36:03 -0400 X-MC-Unique: Y-Qoos19O3KzT4aT7SLUUw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B997E106B244 for ; Tue, 4 Aug 2020 06:36:02 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B5785DA6A; Tue, 4 Aug 2020 06:36:02 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746a0lS518035 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:00 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746Zxjo518034; Tue, 4 Aug 2020 08:35:59 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 3/8] Adjust get_range_info to use the base irange class. Date: Tue, 4 Aug 2020 08:34:41 +0200 Message-Id: <20200804063441.517123-4-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.2 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * tree-ssanames.c (get_range_info): Use irange instead of value_range. * tree-ssanames.h (get_range_info): Same. --- gcc/tree-ssanames.c | 2 +- gcc/tree-ssanames.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index c143a93b072..d9432657e30 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -441,7 +441,7 @@ get_range_info (const_tree name, wide_int *min, wide_int *max) in a value_range VR. Returns the value_range_kind. */ enum value_range_kind -get_range_info (const_tree name, value_range &vr) +get_range_info (const_tree name, irange &vr) { tree min, max; wide_int wmin, wmax; diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h index 47df4e40062..3395824e425 100644 --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -73,7 +73,7 @@ extern void set_range_info (tree, const value_range &); /* Gets the value range from SSA. */ extern enum value_range_kind get_range_info (const_tree, wide_int *, wide_int *); -extern enum value_range_kind get_range_info (const_tree, value_range &); +extern enum value_range_kind get_range_info (const_tree, irange &); extern void set_nonzero_bits (tree, const wide_int_ref &); extern wide_int get_nonzero_bits (const_tree); extern bool ssa_name_has_boolean_range (tree); From patchwork Tue Aug 4 06:34:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=UZLfZEzz; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ4z2z8Pz9sSt for ; Tue, 4 Aug 2020 16:36:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39F2E3844038; Tue, 4 Aug 2020 06:36:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39F2E3844038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596522977; bh=6BAr7x7U8Y4PzIck2tDy5T+PE6iPs7XG6YctQjaw0X8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UZLfZEzzaRWL8AMn11LbozbIfy2txMS6tksMjit4syZnRSyhcYP2WDivAUndTuMPk E60wMAyR0304ATVCgZCacZt/LKIfxcuXKSGki2wjQ4FUpV/KhSZu7IPvT3zAjQZVq1 7jf4oMOBqwibCr3S0H9o67WkEq0Kwwyk/T/n1+ZE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 1A15A3844045 for ; Tue, 4 Aug 2020 06:36:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1A15A3844045 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-STb0XY5ROJuH8FCa2z0VMg-1; Tue, 04 Aug 2020 02:36:13 -0400 X-MC-Unique: STb0XY5ROJuH8FCa2z0VMg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E4701005266 for ; Tue, 4 Aug 2020 06:36:12 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E89AF5DA33; Tue, 4 Aug 2020 06:36:11 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746a9uu518041 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:09 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746a98H518040; Tue, 4 Aug 2020 08:36:09 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 4/8] Adjust op_with_boolean_value_range_p for irange API. Date: Tue, 4 Aug 2020 08:34:43 +0200 Message-Id: <20200804063441.517123-5-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.2 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" It seems to me that we should also check for [0,0] and [1,1] in the range, but I am leaving things as is to avoid functional changes. gcc/ChangeLog: * vr-values.c (simplify_using_ranges::op_with_boolean_value_range_p): Adjust for irange API. --- gcc/vr-values.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 609375c072e..1190fa96453 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -448,10 +448,11 @@ simplify_using_ranges::op_with_boolean_value_range_p (tree op) if (TREE_CODE (op) != SSA_NAME) return false; + /* ?? Errr, this should probably check for [0,0] and [1,1] as well + as [0,1]. */ const value_range *vr = get_value_range (op); - return (vr->kind () == VR_RANGE - && integer_zerop (vr->min ()) - && integer_onep (vr->max ())); + return *vr == value_range (build_zero_cst (TREE_TYPE (op)), + build_one_cst (TREE_TYPE (op))); } /* Extract value range information for VAR when (OP COND_CODE LIMIT) is From patchwork Tue Aug 4 06:34:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=PSKBoOyj; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ5P62Tqz9sRR for ; Tue, 4 Aug 2020 16:36:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A981A384403F; Tue, 4 Aug 2020 06:36:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A981A384403F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596522999; bh=GbE0gNPAZP4eGWjI06n1gE3KVI9+HJf884XS65JTnRg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PSKBoOyjTwJBeg7aSveV72wiUYFcg9ClBx+HILorPCEPmEpD1n9EEn0nvR98yZPTB isY09Hq8p1x/sZjyYPh3A+sE2/CbLUzr8bpvxA7YIHX574NrfLFZlh/FRpmGfdLve1 mGqjferzYcDXnkM2CdyImLgZcRx0TVVQZUOFV6yI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 2079C3844036 for ; Tue, 4 Aug 2020 06:36:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2079C3844036 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-UPM8CzKwPkaTeNt_UlRubQ-1; Tue, 04 Aug 2020 02:36:34 -0400 X-MC-Unique: UPM8CzKwPkaTeNt_UlRubQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F139391272 for ; Tue, 4 Aug 2020 06:36:33 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 884E75D98F; Tue, 4 Aug 2020 06:36:33 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746aVeI518047 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:31 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746aVfg518046; Tue, 4 Aug 2020 08:36:31 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 5/8] Adjust vrp_evaluate_conditional for irange API. Date: Tue, 4 Aug 2020 08:34:45 +0200 Message-Id: <20200804063441.517123-6-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.3 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" VR_RANGE of [-INF,+INF] is canonicalized to VARYING at creation. That is why the test now becomes varying_p(). gcc/ChangeLog: * vr-values.c (simplify_using_ranges::vrp_evaluate_conditional): Adjust for irange API. --- gcc/vr-values.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 1190fa96453..90ba8fca246 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -2495,11 +2495,7 @@ simplify_using_ranges::vrp_evaluate_conditional (tree_code code, tree op0, tree type = TREE_TYPE (op0); const value_range_equiv *vr0 = get_value_range (op0); - if (vr0->kind () == VR_RANGE - && INTEGRAL_TYPE_P (type) - && vrp_val_is_min (vr0->min ()) - && vrp_val_is_max (vr0->max ()) - && is_gimple_min_invariant (op1)) + if (vr0->varying_p () && INTEGRAL_TYPE_P (type)) { location_t location; From patchwork Tue Aug 4 06:34:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=Y79c4oFT; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ5f4Y2Mz9sTC for ; Tue, 4 Aug 2020 16:36:54 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 484393844036; Tue, 4 Aug 2020 06:36:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 484393844036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596523012; bh=svN3l/HchJ4nK3pAl/MqA56lpCBX/HYHvPse+/r2rlY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Y79c4oFThQl2qFgpSUdV6/lELSFueSMztqMquyTsu40t0zgKE1psj0sqY03OpRX3K JVs2nQXr5mCGuOowMpZ6f0WvRc9MY1obf+2JPJVhBYd4DxumZywb/fX6OI1M9OY12N LCPjS1TcZVeRfxBkmLeJB1bxScCZcRN1BpG62nHY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 75C593844045 for ; Tue, 4 Aug 2020 06:36:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 75C593844045 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-5TeQjpVIOP6xCO4GIq67gA-1; Tue, 04 Aug 2020 02:36:48 -0400 X-MC-Unique: 5TeQjpVIOP6xCO4GIq67gA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E071B1005510 for ; Tue, 4 Aug 2020 06:36:47 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76A4D27CD0; Tue, 4 Aug 2020 06:36:47 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746ajJ3518080 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:45 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746ajUC518079; Tue, 4 Aug 2020 08:36:45 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 6/8] Use irange API in test_for_singularity. Date: Tue, 4 Aug 2020 08:34:47 +0200 Message-Id: <20200804063441.517123-7-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.3 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * vr-values.c (test_for_singularity): Use irange API. (simplify_using_ranges::simplify_cond_using_ranges_1): Do not special case VR_RANGE. --- gcc/vr-values.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 90ba8fca246..e78b25596b0 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -3480,10 +3480,13 @@ test_for_singularity (enum tree_code cond_code, tree op0, value range information we have for op0. */ if (min && max) { - if (compare_values (vr->min (), min) == 1) - min = vr->min (); - if (compare_values (vr->max (), max) == -1) - max = vr->max (); + tree type = TREE_TYPE (op0); + tree tmin = wide_int_to_tree (type, vr->lower_bound ()); + tree tmax = wide_int_to_tree (type, vr->upper_bound ()); + if (compare_values (tmin, min) == 1) + min = tmin; + if (compare_values (tmax, max) == -1) + max = tmax; /* If the new min/max values have converged to a single value, then there is only one value which can satisfy the condition, @@ -3594,7 +3597,7 @@ simplify_using_ranges::simplify_cond_using_ranges_1 (gcond *stmt) /* If we have range information for OP0, then we might be able to simplify this conditional. */ - if (vr->kind () == VR_RANGE) + if (!vr->undefined_p () && !vr->varying_p ()) { tree new_tree = test_for_singularity (cond_code, op0, op1, vr); if (new_tree) From patchwork Tue Aug 4 06:34:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=vU+FZ91L; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ5s67C6z9sRR for ; Tue, 4 Aug 2020 16:37:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDAA3386EC42; Tue, 4 Aug 2020 06:37:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDAA3386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596523023; bh=/plGj6QakKEtuWlZU//2G97ehOZKuY3ZPehkWpS8gp4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vU+FZ91Lp2JOvZrQBnc6PiFONFc1lp9URJ1vhgZ2b+v4A5lyRAagrv9Rc3NwKGmDM C+e6cOaoeX0q3pch5iczlnD0KGfxL7Ljm8kOYQXTyNO4KY6uHu8PwxvRsUd5hJoeoU 2KvrIqMXYphSyQwzFqPPX0/OiSqQUCfC5yCeEjNU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 0CA573844045 for ; Tue, 4 Aug 2020 06:37:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0CA573844045 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-DcsZ9X9xNeiTut3j72q4yQ-1; Tue, 04 Aug 2020 02:36:59 -0400 X-MC-Unique: DcsZ9X9xNeiTut3j72q4yQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8236F10059A2 for ; Tue, 4 Aug 2020 06:36:58 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22CC490E7F; Tue, 4 Aug 2020 06:36:57 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746aqaX518085 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:52 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746aq0R518084; Tue, 4 Aug 2020 08:36:52 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 7/8] Adjust simplify_conversion_using_ranges for irange API. Date: Tue, 4 Aug 2020 08:34:49 +0200 Message-Id: <20200804063441.517123-8-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.3 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * vr-values.c (simplify_conversion_using_ranges): Convert to irange API. --- gcc/vr-values.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index e78b25596b0..38c9a657dad 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -3969,11 +3969,14 @@ simplify_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt) /* Get the value-range of the inner operand. Use get_range_info in case innerop was created during substitute-and-fold. */ wide_int imin, imax; - if (!INTEGRAL_TYPE_P (TREE_TYPE (innerop)) - || get_range_info (innerop, &imin, &imax) != VR_RANGE) + value_range vr; + if (!INTEGRAL_TYPE_P (TREE_TYPE (innerop))) return false; - innermin = widest_int::from (imin, TYPE_SIGN (TREE_TYPE (innerop))); - innermax = widest_int::from (imax, TYPE_SIGN (TREE_TYPE (innerop))); + get_range_info (innerop, vr); + if (vr.undefined_p () || vr.varying_p ()) + return false; + innermin = widest_int::from (vr.lower_bound (), TYPE_SIGN (TREE_TYPE (innerop))); + innermax = widest_int::from (vr.upper_bound (), TYPE_SIGN (TREE_TYPE (innerop))); /* Simulate the conversion chain to check if the result is equal if the middle conversion is removed. */ From patchwork Tue Aug 4 06:34:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1340694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=NAp3AgZs; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLQ5y0c37z9sSt for ; Tue, 4 Aug 2020 16:37:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0123A386F47D; Tue, 4 Aug 2020 06:37:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0123A386F47D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596523026; bh=jWpEIxKiPDGtiW+NjCpibyIUPbs4dC7tFjX/dkz25ZY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NAp3AgZsLkOjX5+VMmJ5f9zRsqZ+pTgdb5YMDrHkaqcXkLdDUUHS9BA9oPCUvypMN 6OmZaghHeaCX6EPXh+taIHhrsP8YGSGIOXokItw7cViTTYCIODvweNnAGPMLqUbFZj IKYOUy2yOkdm4knHeHN88L6IcwLprNArnHF9ugXw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 951203844045 for ; Tue, 4 Aug 2020 06:37:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 951203844045 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-G7w2AYowMke-C-haR310Mg-1; Tue, 04 Aug 2020 02:37:02 -0400 X-MC-Unique: G7w2AYowMke-C-haR310Mg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 505A019253C3 for ; Tue, 4 Aug 2020 06:37:01 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2BF274F4D; Tue, 4 Aug 2020 06:37:00 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.15.2/8.15.2) with ESMTPS id 0746awOx518091 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 4 Aug 2020 08:36:58 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.15.2/8.15.2/Submit) id 0746aw5F518090; Tue, 4 Aug 2020 08:36:58 +0200 To: gcc-patches@gcc.gnu.org Subject: [PUSHED 8/8] Adjust two_valued_val_range_p for irange API. Date: Tue, 4 Aug 2020 08:34:51 +0200 Message-Id: <20200804063441.517123-9-aldyh@redhat.com> In-Reply-To: <20200804063441.517123-1-aldyh@redhat.com> References: <20200804063441.517123-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.4 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, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * vr-values.c (simplify_using_ranges::two_valued_val_range_p): Use irange API. --- gcc/vr-values.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 38c9a657dad..2fd4956a2e4 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -4194,33 +4194,20 @@ simplify_using_ranges::simplify_internal_call_using_ranges bool simplify_using_ranges::two_valued_val_range_p (tree var, tree *a, tree *b) { - const value_range *vr = get_value_range (var); - if (vr->varying_p () - || vr->undefined_p () - || TREE_CODE (vr->min ()) != INTEGER_CST - || TREE_CODE (vr->max ()) != INTEGER_CST) + value_range vr = *get_value_range (var); + vr.normalize_symbolics (); + if (vr.varying_p () || vr.undefined_p ()) return false; - if (vr->kind () == VR_RANGE - && wi::to_wide (vr->max ()) - wi::to_wide (vr->min ()) == 1) - { - *a = vr->min (); - *b = vr->max (); - return true; - } - - /* ~[TYPE_MIN + 1, TYPE_MAX - 1] */ - if (vr->kind () == VR_ANTI_RANGE - && (wi::to_wide (vr->min ()) - - wi::to_wide (vrp_val_min (TREE_TYPE (var)))) == 1 - && (wi::to_wide (vrp_val_max (TREE_TYPE (var))) - - wi::to_wide (vr->max ())) == 1) + if ((vr.num_pairs () == 1 && vr.upper_bound () - vr.lower_bound () == 1) + || (vr.num_pairs () == 2 + && vr.lower_bound (0) == vr.upper_bound (0) + && vr.lower_bound (1) == vr.upper_bound (1))) { - *a = vrp_val_min (TREE_TYPE (var)); - *b = vrp_val_max (TREE_TYPE (var)); + *a = wide_int_to_tree (TREE_TYPE (var), vr.lower_bound ()); + *b = wide_int_to_tree (TREE_TYPE (var), vr.upper_bound ()); return true; } - return false; }