Commit eace8c18 by Daniel Berlin Committed by Daniel Berlin

tree-vn.c (get_value_handle): Make sure that given an is_gimple_min_invariant…

tree-vn.c (get_value_handle): Make sure that given an is_gimple_min_invariant expression, we always return it.

2005-02-15  Daniel Berlin  <dberlin@dberlin.org>

	* tree-vn.c (get_value_handle): Make sure that given an
	is_gimple_min_invariant expression, we always return it.

From-SVN: r95072
parent e5e459bf
2005-02-15 Daniel Berlin <dberlin@dberlin.org>
* tree-vn.c (get_value_handle): Make sure that given an
is_gimple_min_invariant expression, we always return it.
2005-02-15 Kazu Hirata <kazu@cs.umass.edu> 2005-02-15 Kazu Hirata <kazu@cs.umass.edu>
* passes.c (rest_of_handle_gcse): Fix a comment. * passes.c (rest_of_handle_gcse): Fix a comment.
......
...@@ -267,11 +267,16 @@ vn_lookup_or_add (tree expr, vuse_optype vuses) ...@@ -267,11 +267,16 @@ vn_lookup_or_add (tree expr, vuse_optype vuses)
/* Get the value handle of EXPR. This is the only correct way to get /* Get the value handle of EXPR. This is the only correct way to get
the value handle for a "thing". If EXPR does not have a value the value handle for a "thing". If EXPR does not have a value
handle associated, it returns NULL_TREE. */ handle associated, it returns NULL_TREE.
NB: If EXPR is min_invariant, this function is *required* to return EXPR. */
tree tree
get_value_handle (tree expr) get_value_handle (tree expr)
{ {
if (is_gimple_min_invariant (expr))
return expr;
if (TREE_CODE (expr) == SSA_NAME) if (TREE_CODE (expr) == SSA_NAME)
return SSA_NAME_VALUE (expr); return SSA_NAME_VALUE (expr);
else if (EXPR_P (expr) || DECL_P (expr)) else if (EXPR_P (expr) || DECL_P (expr))
...@@ -280,10 +285,7 @@ get_value_handle (tree expr) ...@@ -280,10 +285,7 @@ get_value_handle (tree expr)
return ((ann) ? ann->common.value_handle : NULL_TREE); return ((ann) ? ann->common.value_handle : NULL_TREE);
} }
else else
{ gcc_unreachable ();
gcc_assert (is_gimple_min_invariant (expr));
return expr;
}
} }
......
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