From patchwork Fri Jun 3 07:32:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 54772 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A07E3839198 for ; Fri, 3 Jun 2022 07:34:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A07E3839198 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654241690; bh=nGi8FHk5wwXTXWrKG+e6qyF4zqwp6swssjEHVE4lwP0=; 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=bXn6NDu5VM1vdBaNiWyUyHDBaTlZrlcj0TaGJw14QZ2tYv2AhY2hluYXJxjmqrzRZ 4amlxc7PL6SjH4BasdSrs7u31s/rNqF1Qi7EEB/it52XKIoHfOvkqy6KDZYOmr4Ps2 DCNFr01yVfG0oFLqWS0EeoJw8q357CHqXz9wzGbU= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id D88053839C6F for ; Fri, 3 Jun 2022 07:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D88053839C6F Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-DDA1fuUbMxC5UMXzBFYRcg-1; Fri, 03 Jun 2022 03:32:28 -0400 X-MC-Unique: DDA1fuUbMxC5UMXzBFYRcg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03F8980159B for ; Fri, 3 Jun 2022 07:32:28 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77C9F492C3B; Fri, 3 Jun 2022 07:32:27 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 2537WOcC2683124 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 3 Jun 2022 09:32:25 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 2537WOSQ2683123; Fri, 3 Jun 2022 09:32:24 +0200 To: GCC patches Subject: [COMMITTED] Misc range temporary fixes. Date: Fri, 3 Jun 2022 09:32:19 +0200 Message-Id: <20220603073219.2683070-3-aldyh@redhat.com> In-Reply-To: <20220603073219.2683070-1-aldyh@redhat.com> References: <20220603073219.2683070-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.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, T_SCC_BODY_TEXT_LINE 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This fixes a couples places that were using int_range_max, but needed a generic temporary. Found while merging the frange work. Also, copying between range temporaries is actually useful :). Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-cache.cc (ranger_cache::range_from_dom): Use Value_Range. * gimple-range.cc (gimple_ranger::register_inferred_ranges): Same. * value-range.h (Value_Range::Value_Range): Implement copy constructor for Value_Range. --- gcc/gimple-range-cache.cc | 2 +- gcc/gimple-range.cc | 9 ++++++--- gcc/value-range.h | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 85eed4421f4..f3494363a10 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -1372,7 +1372,7 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb, // each incoming edge now and accumulate the results. r.set_undefined (); edge_iterator ei; - int_range_max er; + Value_Range er (TREE_TYPE (name)); FOR_EACH_EDGE (e, ei, prev_bb->preds) { edge_range (er, e, name, RFD_READ_ONLY); diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 67dafb2a2c0..f3a46555f91 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -461,17 +461,20 @@ gimple_ranger::register_inferred_ranges (gimple *s) tree lhs = gimple_get_lhs (s); if (lhs) { - int_range_max tmp; + Value_Range tmp (TREE_TYPE (lhs)); if (range_of_stmt (tmp, s, lhs) && !tmp.varying_p () && update_global_range (tmp, lhs) && dump_file) { - value_range vr = tmp; + // ?? This section should be adjusted when non-iranges can + // be exported. For now, the only way update_global_range + // above can succeed is with an irange so this is safe. + value_range vr = as_a (tmp); fprintf (dump_file, "Global Exported: "); print_generic_expr (dump_file, lhs, TDF_SLIM); fprintf (dump_file, " = "); vr.dump (dump_file); int_range_max same = vr; - if (same != tmp) + if (same != as_a (tmp)) { fprintf (dump_file, " ... irange was : "); tmp.dump (dump_file); diff --git a/gcc/value-range.h b/gcc/value-range.h index 26e41ed2982..dc6f6b0f935 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -314,6 +314,7 @@ public: Value_Range (); Value_Range (const vrange &r); Value_Range (tree type); + Value_Range (const Value_Range &); void set_type (tree type); vrange& operator= (const vrange &); bool operator== (const Value_Range &r) const; @@ -344,7 +345,6 @@ private: unsupported_range m_unsupported; vrange *m_vrange; int_range_max m_irange; - DISABLE_COPY_AND_ASSIGN (Value_Range); }; inline @@ -370,6 +370,12 @@ Value_Range::Value_Range (tree type) init (type); } +inline +Value_Range::Value_Range (const Value_Range &r) +{ + m_vrange = r.m_vrange; +} + // Initialize object so it is possible to store temporaries of TYPE // into it.