From patchwork Wed Apr 26 08:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1773940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.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=qNtXhi/H; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5sdG1pkdz23vJ for ; Wed, 26 Apr 2023 18:35:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 220973853566 for ; Wed, 26 Apr 2023 08:35:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 220973853566 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682498128; bh=t9jJS0tThGDLvGJmeqChF0BnHO4oxiXT97JZxaf9WTU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=qNtXhi/HhLi1uSkh4lf7SAmD8jkpeqLamW2ua/30Xb+PfkQTQad2yLsVVDgSdsKvw r56G6c3+NrWqnhYxNxufVKhi+1ZF72GYK1rEtw0WB7BjvJvXAi8rruwL6ZSsgabLGG tawOMVEWPHOtKokSNnJL/GgJ1k/8jlGuoRanWkXk= 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 568523858C27 for ; Wed, 26 Apr 2023 08:33:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 568523858C27 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-88-VUMGx2OkNWWJ36TjXzUfuQ-1; Wed, 26 Apr 2023 04:33:50 -0400 X-MC-Unique: VUMGx2OkNWWJ36TjXzUfuQ-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 7AF0B101A555 for ; Wed, 26 Apr 2023 08:33:50 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEC08492B03; Wed, 26 Apr 2023 08:33:49 +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 33Q8Xmfs313601 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 10:33:48 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 33Q8XmDQ313600; Wed, 26 Apr 2023 10:33:48 +0200 To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] Refactor vrp_evaluate_conditional* and rename it. Date: Wed, 26 Apr 2023 10:33:21 +0200 Message-Id: <20230426083328.313566-2-aldyh@redhat.com> In-Reply-To: <20230426083328.313566-1-aldyh@redhat.com> References: <20230426083328.313566-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.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_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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * vr-values.cc (simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops): Rename to... (simplify_using_ranges::legacy_fold_cond_overflow): ...this. (simplify_using_ranges::vrp_visit_cond_stmt): Rename to... (simplify_using_ranges::legacy_fold_cond): ...this. (simplify_using_ranges::fold_cond): Rename vrp_evaluate_conditional_warnv_with_ops to legacy_fold_cond_overflow. * vr-values.h (class vr_values): Replace vrp_visit_cond_stmt and vrp_evaluate_conditional_warnv_with_ops with legacy_fold_cond and legacy_fold_cond_overflow respectively. --- gcc/vr-values.cc | 25 +++++++++++-------------- gcc/vr-values.h | 5 ++--- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc index 1d757eeffc3..e8643ea321e 100644 --- a/gcc/vr-values.cc +++ b/gcc/vr-values.cc @@ -638,20 +638,21 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops_using_ranges return res; } -/* Helper function for vrp_evaluate_conditional_warnv. */ +/* Helper function for legacy_fold_cond. */ tree -simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops - (gimple *stmt, - enum tree_code code, - tree op0, tree op1, - bool *strict_overflow_p, - bool *only_ranges) +simplify_using_ranges::legacy_fold_cond_overflow (gimple *stmt, + bool *strict_overflow_p, + bool *only_ranges) { tree ret; if (only_ranges) *only_ranges = true; + tree_code code = gimple_cond_code (stmt); + tree op0 = gimple_cond_lhs (stmt); + tree op1 = gimple_cond_rhs (stmt); + /* We only deal with integral and pointer types. */ if (!INTEGRAL_TYPE_P (TREE_TYPE (op0)) && !POINTER_TYPE_P (TREE_TYPE (op0))) @@ -736,7 +737,7 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops *TAKEN_EDGE_P. Otherwise, set *TAKEN_EDGE_P to NULL. */ void -simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p) +simplify_using_ranges::legacy_fold_cond (gcond *stmt, edge *taken_edge_p) { tree val; @@ -765,11 +766,7 @@ simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p) } bool sop; - val = vrp_evaluate_conditional_warnv_with_ops (stmt, - gimple_cond_code (stmt), - gimple_cond_lhs (stmt), - gimple_cond_rhs (stmt), - &sop, NULL); + val = legacy_fold_cond_overflow (stmt, &sop, NULL); if (val) *taken_edge_p = find_taken_edge (gimple_bb (stmt), val); @@ -1471,7 +1468,7 @@ simplify_using_ranges::fold_cond (gcond *cond) // FIXME: Audit the code below and make sure it never finds anything. edge taken_edge; - vrp_visit_cond_stmt (cond, &taken_edge); + legacy_fold_cond (cond, &taken_edge); if (taken_edge) { diff --git a/gcc/vr-values.h b/gcc/vr-values.h index a89902c9c51..ff814155881 100644 --- a/gcc/vr-values.h +++ b/gcc/vr-values.h @@ -35,9 +35,8 @@ public: bool simplify (gimple_stmt_iterator *); bool fold_cond (gcond *); private: - void vrp_visit_cond_stmt (gcond *, edge *); - tree vrp_evaluate_conditional_warnv_with_ops (gimple *stmt, enum tree_code, - tree, tree, bool *, bool *); + void legacy_fold_cond (gcond *, edge *); + tree legacy_fold_cond_overflow (gimple *stmt, bool *, bool *); bool simplify_casted_cond (gcond *); bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *); bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *);