diff options
author | Jan Hubicka <jh@suse.cz> | 2010-07-22 00:56:27 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-07-21 22:56:27 +0000 |
commit | 37512c66d03eae9bca2b0c5dc7c200ef573a37cb (patch) | |
tree | ae19d6db2b1fe095712bd316a29d8bfc65cc3e01 | |
parent | dbb9443595084d94c8e785f4d86d1c72d1b72f96 (diff) | |
download | gcc-37512c66d03eae9bca2b0c5dc7c200ef573a37cb.zip gcc-37512c66d03eae9bca2b0c5dc7c200ef573a37cb.tar.gz gcc-37512c66d03eae9bca2b0c5dc7c200ef573a37cb.tar.bz2 |
ipa-pure-const.c (varying_state): Break out from ...
* ipa-pure-const.c (varying_state): Break out from ...
(get_function_state): ... here; always return varying_state
when state would be NULL otherwise.
(remove_node_data): Do not free varying state.
From-SVN: r162392
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 18 |
2 files changed, 19 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cef2e9..5e78b4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-07-22 Jan Hubicka <jh@suse.cz> + + * ipa-pure-const.c (varying_state): Break out from ... + (get_function_state): ... here; always return varying_state + when state would be NULL otherwise. + (remove_node_data): Do not free varying state. + 2010-07-22 Bernd Schmidt <bernds@codesourcery.com> PR bootstrap/44970 diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 7417429..4a29e10 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -95,6 +95,11 @@ struct funct_state_d bool can_throw; }; +/* State used when we know nothing about function. */ +static struct funct_state_d varying_state + = { IPA_NEITHER, IPA_NEITHER, true, true, true }; + + typedef struct funct_state_d * funct_state; /* The storage of the funct_state is abstracted because there is the @@ -212,13 +217,12 @@ has_function_state (struct cgraph_node *node) static inline funct_state get_function_state (struct cgraph_node *node) { - static struct funct_state_d varying - = { IPA_NEITHER, IPA_NEITHER, true, true, true }; if (!funct_state_vec - || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid) + || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid + || !VEC_index (funct_state, funct_state_vec, node->uid)) /* We might want to put correct previously_known state into varying. */ - return &varying; - return VEC_index (funct_state, funct_state_vec, node->uid); + return &varying_state; + return VEC_index (funct_state, funct_state_vec, node->uid); } /* Set the function state S for NODE. */ @@ -860,7 +864,9 @@ remove_node_data (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) { if (has_function_state (node)) { - free (get_function_state (node)); + funct_state l = get_function_state (node); + if (l != &varying_state) + free (l); set_function_state (node, NULL); } } |