From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by sourceware.org (Postfix) with ESMTPS id 8D0613858C32 for ; Sun, 28 Apr 2024 19:06:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D0613858C32 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=localhost.redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8D0613858C32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.139.111.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714331170; cv=none; b=wssWga0HCjxpiG3Q6ECEaHrzwCBkc8/kA1Yf6M2nUgq9pYlFeob6Zla9Z/z6GSe72d4s1anjA5yODYlQri4LdLOxZGGH6dApVaAOqovTIQ3f6Td/15vohV3OKgxFv0RP7nf16t69BKDsMPE8bbgsKNVgnbAaF/vVZWkzOJ0MnW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714331170; c=relaxed/simple; bh=NxKGYvCwCUARju9otewxBhIRhVaI9TBYTRVI+lrha78=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YHRGkKgBSPBrpNNdY3Z0/6PFs8+K5boU+ErCyAtWDAQ9mfZrq9TJuNeL6U5Mk73YqHdO6eG6nO6KhKHfqO6cRSGSUW2Uk65GZmhFFaKV0VH+0M+cExZDdOhBU+x6lFGl3LhUR8YCN6O773lulhQW8aV0LN+Qj+Z/AiRQSXEYMTQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714331165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XEMBTFfVkPryp4aeuMQ7Tzqhu8box4FS38d3HLHn+fM=; b=Sn/q0HDc00Y0j1hdwZEeJ4AAP9oP+de201nwFy0iHYSmCPQ3Gw3fu/3o1GAgsJzD8QMuWC k7YDxBzoIKM33F7Xi1e50bgceK2JAMP0tGpd1ADOccNKd0OUYl/Iy2TlLz0QBXYmT2uk/9 gC1mwtazzsrGB57ZRwbOU82M+6YOrFA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-602-NRnco3YmMo2w7lQVqAeN1w-1; Sun, 28 Apr 2024 15:06:03 -0400 X-MC-Unique: NRnco3YmMo2w7lQVqAeN1w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5C3D9802352 for ; Sun, 28 Apr 2024 19:06:03 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.56]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D3DF202450F; Sun, 28 Apr 2024 19:06:02 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.2/8.17.1) with ESMTPS id 43SJ61XZ1209696 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 28 Apr 2024 21:06:01 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.2/8.17.2/Submit) id 43SJ61JX1209695; Sun, 28 Apr 2024 21:06:01 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED 15/16] Remove range_zero and range_nonzero. Date: Sun, 28 Apr 2024 21:05:53 +0200 Message-ID: <20240428190557.1209586-16-aldyh@redhat.com> In-Reply-To: <20240428190557.1209586-1-aldyh@redhat.com> References: <20240428190557.1209586-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; x-default=true X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_LOW,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 List-Id: Remove legacy range_zero and range_nonzero as they return by value, which make it not work in a separate irange and prange world. Also, we already have set_zero and set_nonzero methods in vrange. gcc/ChangeLog: =09* range-op-ptr.cc (pointer_plus_operator::wi_fold): Use method =09range setters instead of out of line functions. =09(pointer_min_max_operator::wi_fold): Same. =09(pointer_and_operator::wi_fold): Same. =09(pointer_or_operator::wi_fold): Same. =09* range-op.cc (operator_negate::fold_range): Same. =09(operator_addr_expr::fold_range): Same. =09(range_op_cast_tests): Same. =09* range.cc (range_zero): Remove. =09(range_nonzero): Remove. =09* range.h (range_zero): Remove. =09(range_nonzero): Remove. =09* value-range.cc (range_tests_misc): Use method instead of out of =09line function. --- gcc/range-op-ptr.cc | 14 +++++++------- gcc/range-op.cc | 14 ++++++++------ gcc/range.cc | 14 -------------- gcc/range.h | 2 -- gcc/value-range.cc | 7 ++++--- 5 files changed, 19 insertions(+), 32 deletions(-) diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index 2c85d75b5e8..7343ef635f3 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc @@ -101,10 +101,10 @@ pointer_plus_operator::wi_fold (irange &r, tree type, && !TYPE_OVERFLOW_WRAPS (type) && (flag_delete_null_pointer_checks =09 || !wi::sign_mask (rh_ub))) - r =3D range_nonzero (type); + r.set_nonzero (type); else if (lh_lb =3D=3D lh_ub && lh_lb =3D=3D 0 =09 && rh_lb =3D=3D rh_ub && rh_lb =3D=3D 0) - r =3D range_zero (type); + r.set_zero (type); else r.set_varying (type); } @@ -150,9 +150,9 @@ pointer_min_max_operator::wi_fold (irange &r, tree type= , // are varying. if (!wi_includes_zero_p (type, lh_lb, lh_ub) && !wi_includes_zero_p (type, rh_lb, rh_ub)) - r =3D range_nonzero (type); + r.set_nonzero (type); else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub= )) - r =3D range_zero (type); + r.set_zero (type); else r.set_varying (type); } @@ -175,7 +175,7 @@ pointer_and_operator::wi_fold (irange &r, tree type, // For pointer types, we are really only interested in asserting // whether the expression evaluates to non-NULL. if (wi_zero_p (type, lh_lb, lh_ub) || wi_zero_p (type, lh_lb, lh_ub)) - r =3D range_zero (type); + r.set_zero (type); else r.set_varying (type); } @@ -236,9 +236,9 @@ pointer_or_operator::wi_fold (irange &r, tree type, // whether the expression evaluates to non-NULL. if (!wi_includes_zero_p (type, lh_lb, lh_ub) && !wi_includes_zero_p (type, rh_lb, rh_ub)) - r =3D range_nonzero (type); + r.set_nonzero (type); else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub= )) - r =3D range_zero (type); + r.set_zero (type); else r.set_varying (type); } diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 6ea7d624a9b..ab3a4f0b200 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -4364,9 +4364,11 @@ operator_negate::fold_range (irange &r, tree type, { if (empty_range_varying (r, type, lh, rh)) return true; - // -X is simply 0 - X. - return range_op_handler (MINUS_EXPR).fold_range (r, type, -=09=09=09=09=09=09 range_zero (type), lh); + +// -X is simply 0 - X. + int_range<1> zero; + zero.set_zero (type); + return range_op_handler (MINUS_EXPR).fold_range (r, type, zero, lh); } =20 bool @@ -4391,7 +4393,7 @@ operator_addr_expr::fold_range (irange &r, tree type, =20 // Return a non-null pointer of the LHS type (passed in op2). if (lh.zero_p ()) - r =3D range_zero (type); + r.set_zero (type); else if (lh.undefined_p () || contains_zero_p (lh)) r.set_varying (type); else @@ -4675,7 +4677,7 @@ range_op_cast_tests () if (TYPE_PRECISION (integer_type_node) > TYPE_PRECISION (short_integer_type_node)) { - r0 =3D range_nonzero (integer_type_node); + r0.set_nonzero (integer_type_node); range_cast (r0, short_integer_type_node); r1 =3D int_range<1> (short_integer_type_node, =09=09=09 min_limit (short_integer_type_node), @@ -4687,7 +4689,7 @@ range_op_cast_tests () // // NONZERO signed 16-bits is [-MIN_16,-1][1, +MAX_16]. // Converting this to 32-bits signed is [-MIN_16,-1][1, +MAX_16]. - r0 =3D range_nonzero (short_integer_type_node); + r0.set_nonzero (short_integer_type_node); range_cast (r0, integer_type_node); r1 =3D int_range<1> (integer_type_node, INT (-32768), INT (-1)); r2 =3D int_range<1> (integer_type_node, INT (1), INT (32767)); diff --git a/gcc/range.cc b/gcc/range.cc index c68f387f71c..b362e0f12e0 100644 --- a/gcc/range.cc +++ b/gcc/range.cc @@ -29,20 +29,6 @@ along with GCC; see the file COPYING3. If not see #include "ssa.h" #include "range.h" =20 -value_range -range_zero (tree type) -{ - wide_int zero =3D wi::zero (TYPE_PRECISION (type)); - return value_range (type, zero, zero); -} - -value_range -range_nonzero (tree type) -{ - wide_int zero =3D wi::zero (TYPE_PRECISION (type)); - return value_range (type, zero, zero, VR_ANTI_RANGE); -} - value_range range_positives (tree type) { diff --git a/gcc/range.h b/gcc/range.h index 391ea02daf5..eccb9490e4d 100644 --- a/gcc/range.h +++ b/gcc/range.h @@ -21,8 +21,6 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_RANGE_H #define GCC_RANGE_H =20 -value_range range_zero (tree type); -value_range range_nonzero (tree type); value_range range_positives (tree type); value_range range_negatives (tree type); =20 diff --git a/gcc/value-range.cc b/gcc/value-range.cc index d9689bd469f..a27de5534e1 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -2447,7 +2447,8 @@ range_tests_misc () ASSERT_TRUE (not_255 =3D=3D range_uchar (0, 254)); =20 // Test that NOT(0) is [1..255] in 8-bit land. - int_range<2> not_zero =3D range_nonzero (unsigned_char_type_node); + int_range<2> not_zero; + not_zero.set_nonzero (unsigned_char_type_node); ASSERT_TRUE (not_zero =3D=3D range_uchar (1, 255)); =20 // Check that [0,127][0x..ffffff80,0x..ffffff] @@ -2526,7 +2527,7 @@ range_tests_misc () ASSERT_TRUE (r0 =3D=3D r2); =20 // Test that booleans and their inverse work as expected. - r0 =3D range_zero (boolean_type_node); + r0.set_zero (boolean_type_node); ASSERT_TRUE (r0 =3D=3D range_false ()); r0.invert (); ASSERT_TRUE (r0 =3D=3D range_true ()); @@ -2534,7 +2535,7 @@ range_tests_misc () // Make sure NULL and non-NULL of pointer types work, and that // inverses of them are consistent. tree voidp =3D build_pointer_type (void_type_node); - r0 =3D range_zero (voidp); + r0.set_zero (voidp); r1 =3D r0; r0.invert (); r0.invert (); --=20 2.44.0