From patchwork Sat Nov 18 08:49:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 839231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-467276-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LAKo8Ijb"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yf7vs0RDPz9ryT for ; Sat, 18 Nov 2017 19:49:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=B8eYKxHivMBDZb3xPDZ5HZdO5z2NKffBxKKAnvTcqLQkVYoUTVajE 1+44YGmmPhBHHPjMj4eEanpS/z0GzFAeQJS44FjkvB3AKvBq//IQmz6wNcjnNZHl nTdOZbhMgBZ9wgK4jIERSdDYoPClc2nbldpSC6+uXPQHhRvYxDAvb8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=7AA8H0YDXvitknToB7A3ugEkklQ=; b=LAKo8IjbWG1CV7tiqnV9 zYczs/DprwxFdI6LrONAKDdTk8RScKubDVicrugLoNn/YuPmNLOXM6OSISbccvGu FDtaXYRxLiWwu4I7MHvTFmtg4JVYW3xVtYxq8zvNxxIYMOjb8LwkRV8QoxS2srvo WNW/VAdsiCpS9ca9Bq3jjUk= Received: (qmail 815 invoked by alias); 18 Nov 2017 08:49:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 802 invoked by uid 89); 18 Nov 2017 08:49:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Nov 2017 08:49:30 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C2D199C78 for ; Sat, 18 Nov 2017 08:49:29 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-12.rdu2.redhat.com [10.10.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D1902A820 for ; Sat, 18 Nov 2017 08:49:28 +0000 (UTC) From: Jeff Law Subject: [RFA][PATCH] 11/n More VRP related cleanups To: gcc-patches Message-ID: <5a79fe05-0250-b48e-fafa-d19119ac1b1e@redhat.com> Date: Sat, 18 Nov 2017 01:49:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Not as extensive as the last set. Just getting a couple data members privatized as well as one method within vr_values. I'd really like to just get values_propagated out of vr_values and bury it in tree-vrp.c, but we're not to that point yet. Bootstrapped and regression tested on x86. OK for the trunk? jeff * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Use new method allocate_value_range rather than accessing the vrp_value_range_pool data member directly. * tree-vrp.c (simplify_stmt_for_jump_threading): Tweak slightly to use extract_range_from_stmt method to avoid need for extract_range_from_assignment method. (vrp_prop::vrp_finalize): Use set_lattice_propagation_complete method rather than setting values_propgated data member directly. * vr-values.h (class vr_values): Privatize vrp_value_range_pool, and values propagated data members and extract_range_from_assignment method. Reorder private data members to conform to standards. Add new methods set_lattice_propagation_complete and allocate_value_range. diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c index c3877791a5e..cfaf18feecb 100644 --- a/gcc/gimple-ssa-evrp-analyze.c +++ b/gcc/gimple-ssa-evrp-analyze.c @@ -84,7 +84,7 @@ evrp_range_analyzer::try_find_new_range (tree name, && vrp_operand_equal_p (old_vr->min, vr.min) && vrp_operand_equal_p (old_vr->max, vr.max)) return NULL; - value_range *new_vr = vr_values->vrp_value_range_pool.allocate (); + value_range *new_vr = vr_values->allocate_value_range (); *new_vr = vr; return new_vr; } diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index e248f59a67f..838822d82f6 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6572,14 +6572,17 @@ simplify_stmt_for_jump_threading (gimple *stmt, gimple *within_stmt, if (gassign *assign_stmt = dyn_cast (stmt)) { - value_range new_vr = VR_INITIALIZER; tree lhs = gimple_assign_lhs (assign_stmt); - if (TREE_CODE (lhs) == SSA_NAME && (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) - || POINTER_TYPE_P (TREE_TYPE (lhs)))) + || POINTER_TYPE_P (TREE_TYPE (lhs))) + && stmt_interesting_for_vrp (stmt)) { - vr_values->extract_range_from_assignment (&new_vr, assign_stmt); + edge dummy_e; + tree dummy_tree; + value_range new_vr = VR_INITIALIZER; + vr_values->extract_range_from_stmt (stmt, &dummy_e, + &dummy_tree, &new_vr); if (range_int_cst_singleton_p (&new_vr)) return new_vr.min; } @@ -6747,7 +6750,8 @@ vrp_prop::vrp_finalize (bool warn_array_bounds_p) { size_t i; - vr_values.values_propagated = true; + /* We have completed propagating through the lattice. */ + vr_values.set_lattice_propagation_complete (); if (dump_file) { diff --git a/gcc/vr-values.h b/gcc/vr-values.h index 9eeebedfaed..124ee6f4356 100644 --- a/gcc/vr-values.h +++ b/gcc/vr-values.h @@ -54,7 +54,6 @@ class vr_values tree, tree, value_range *); void extract_range_from_phi_node (gphi *, value_range *); void extract_range_basic (value_range *, gimple *); - void extract_range_from_assignment (value_range *, gassign *); void extract_range_from_stmt (gimple *, edge *, tree *, value_range *); void vrp_visit_cond_stmt (gcond *, edge *); @@ -62,14 +61,14 @@ class vr_values void simplify_cond_using_ranges_2 (gcond *); bool simplify_stmt_using_ranges (gimple_stmt_iterator *); - /* This probably belongs in the lattice rather than in here. */ - bool values_propagated; + /* Indicate that propagation through the lattice is complete. */ + void set_lattice_propagation_complete (void) { values_propagated = true; } - /* Allocation pools for tree-vrp allocations. */ - object_allocator vrp_value_range_pool; + /* Allocate a new value_range object. */ + value_range *allocate_value_range (void) + { return vrp_value_range_pool.allocate (); } private: - bitmap_obstack vrp_equiv_obstack; void add_equivalence (bitmap *, const_tree); bool vrp_stmt_computes_nonzero (gimple *); bool op_with_boolean_value_range_p (tree); @@ -84,6 +83,7 @@ class vr_values tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, tree, tree, bool, bool *, bool *); + void extract_range_from_assignment (value_range *, gassign *); void extract_range_from_assert (value_range *, tree); void extract_range_from_ssa_name (value_range *, tree); void extract_range_from_binary_expr (value_range *, enum tree_code, @@ -106,6 +106,15 @@ class vr_values gimple *); bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); + /* Allocation pools for value_range objects. */ + object_allocator vrp_value_range_pool; + + /* This probably belongs in the lattice rather than in here. */ + bool values_propagated; + + /* Allocations for equivalences all come from this obstack. */ + bitmap_obstack vrp_equiv_obstack; + /* Value range array. After propagation, VR_VALUE[I] holds the range of values that SSA name N_I may take. */ unsigned int num_vr_values;