Commit f432e4fc by Jeff Law Committed by Jeff Law

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
parent 4f2a94e6
2017-11-17 Jeff Law <law@redhat.com>
* 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 <luis.machado@linaro.org> 2017-11-17 Luis Machado <luis.machado@linaro.org>
* config/aarch64/aarch64.c * config/aarch64/aarch64.c
...@@ -1955,19 +1955,18 @@ vrp_valueize_1 (tree name) ...@@ -1955,19 +1955,18 @@ vrp_valueize_1 (tree name)
} }
return name; return name;
} }
/* Visit assignment STMT. If it produces an interesting range, record
the range in VR and set LHS to OUTPUT_P. */
void /* Given STMT, an assignment or call, return its LHS if the type
vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p, of the LHS is suitable for VRP analysis, else return NULL_TREE. */
value_range *vr)
tree
get_output_for_vrp (gimple *stmt)
{ {
tree lhs; if (!is_gimple_assign (stmt) && !is_gimple_call (stmt))
enum gimple_code code = gimple_code (stmt); return NULL_TREE;
lhs = gimple_get_lhs (stmt);
*output_p = NULL_TREE;
/* We only keep track of ranges in integral and pointer types. */ /* We only keep track of ranges in integral and pointer types. */
tree lhs = gimple_get_lhs (stmt);
if (TREE_CODE (lhs) == SSA_NAME if (TREE_CODE (lhs) == SSA_NAME
&& ((INTEGRAL_TYPE_P (TREE_TYPE (lhs)) && ((INTEGRAL_TYPE_P (TREE_TYPE (lhs))
/* It is valid to have NULL MIN/MAX values on a type. See /* 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, ...@@ -1975,8 +1974,25 @@ vr_values::vrp_visit_assignment_or_call (gimple *stmt, tree *output_p,
&& TYPE_MIN_VALUE (TREE_TYPE (lhs)) && TYPE_MIN_VALUE (TREE_TYPE (lhs))
&& TYPE_MAX_VALUE (TREE_TYPE (lhs))) && TYPE_MAX_VALUE (TREE_TYPE (lhs)))
|| POINTER_TYPE_P (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. */ /* Try folding the statement to a constant first. */
x_vr_values = this; x_vr_values = this;
......
...@@ -118,4 +118,5 @@ class vr_values ...@@ -118,4 +118,5 @@ class vr_values
#define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL } #define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }
extern tree get_output_for_vrp (gimple *);
#endif /* GCC_VR_VALUES_H */ #endif /* GCC_VR_VALUES_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment