From 7209680744855b9ca24c2d4ab0c958c5684cbe35 Mon Sep 17 00:00:00 2001 From: dberlin Date: Tue, 15 Feb 2005 20:09:31 +0000 Subject: [PATCH] 2005-02-15 Daniel Berlin * tree-vn.c (get_value_handle): Make sure that given an is_gimple_min_invariant expression, we always return it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95072 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-vn.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77d6c3a0fb8..e90c0306a37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-02-15 Daniel Berlin + + * 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 * passes.c (rest_of_handle_gcse): Fix a comment. diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c index ab952ebadd0..22affffb063 100644 --- a/gcc/tree-vn.c +++ b/gcc/tree-vn.c @@ -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 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 get_value_handle (tree expr) { + + if (is_gimple_min_invariant (expr)) + return expr; + if (TREE_CODE (expr) == SSA_NAME) return SSA_NAME_VALUE (expr); else if (EXPR_P (expr) || DECL_P (expr)) @@ -280,10 +285,7 @@ get_value_handle (tree expr) return ((ann) ? ann->common.value_handle : NULL_TREE); } else - { - gcc_assert (is_gimple_min_invariant (expr)); - return expr; - } + gcc_unreachable (); } -- 2.11.4.GIT