From: Jeff Law Date: Fri, 17 Nov 2017 16:25:22 +0000 (-0700) Subject: vr-values.h (get_output_for_vrp): Prototype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f432e4fc930be596b266f160480514aa7f026e82;p=gcc.git vr-values.h (get_output_for_vrp): Prototype. * vr-values.h (get_output_for_vrp): Prototype. * vr-values.c (get_output_for_vrp): New function extracted from vrp_visit_assignment_or_call and extract_range_from_stmt. (vrp_visit_assignment_or_call): Use get_output_for_vrp. Simplify. From-SVN: r254880 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38101fa3550..82111ba9c2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-11-17 Jeff Law + + * vr-values.h (get_output_for_vrp): Prototype. + * vr-values.c (get_output_for_vrp): New function extracted from + vrp_visit_assignment_or_call and extract_range_from_stmt. + (vrp_visit_assignment_or_call): Use get_output_for_vrp. Simplify. + 2017-11-17 Luis Machado * config/aarch64/aarch64.c diff --git a/gcc/vr-values.c b/gcc/vr-values.c index d4434ded75d..3e760a378fc 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -1955,19 +1955,18 @@ vrp_valueize_1 (tree name) } return name; } -/* Visit assignment STMT. If it produces an interesting range, record - the range in VR and set LHS to OUTPUT_P. */ -void -vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p, - value_range *vr) +/* Given STMT, an assignment or call, return its LHS if the type + of the LHS is suitable for VRP analysis, else return NULL_TREE. */ + +tree +get_output_for_vrp (gimple *stmt) { - tree lhs; - enum gimple_code code = gimple_code (stmt); - lhs = gimple_get_lhs (stmt); - *output_p = NULL_TREE; + if (!is_gimple_assign (stmt) && !is_gimple_call (stmt)) + return NULL_TREE; /* We only keep track of ranges in integral and pointer types. */ + tree lhs = gimple_get_lhs (stmt); if (TREE_CODE (lhs) == SSA_NAME && ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) /* It is valid to have NULL MIN/MAX values on a type. See @@ -1975,8 +1974,25 @@ vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p, && TYPE_MIN_VALUE (TREE_TYPE (lhs)) && TYPE_MAX_VALUE (TREE_TYPE (lhs))) || POINTER_TYPE_P (TREE_TYPE (lhs)))) + return lhs; + + return NULL_TREE; +} + +/* Visit assignment STMT. If it produces an interesting range, record + the range in VR and set LHS to OUTPUT_P. */ + +void +vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p, + value_range *vr) +{ + tree lhs = get_output_for_vrp (stmt); + *output_p = lhs; + + /* We only keep track of ranges in integral and pointer types. */ + if (lhs) { - *output_p = lhs; + enum gimple_code code = gimple_code (stmt); /* Try folding the statement to a constant first. */ x_vr_values = this; diff --git a/gcc/vr-values.h b/gcc/vr-values.h index 20bd6c57a6c..24f013a9402 100644 --- a/gcc/vr-values.h +++ b/gcc/vr-values.h @@ -118,4 +118,5 @@ class vr_values #define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL } +extern tree get_output_for_vrp (gimple *); #endif /* GCC_VR_VALUES_H */