diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-26 23:35:27 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-26 23:35:27 +0000 |
commit | df9b545b744190406822ce3f0e4b664256e720b1 (patch) | |
tree | fa24152c68bb24d01ebfd5359eabb80b6d0be1a2 /gcc/ipa-pure-const.c | |
parent | 5cc6fc7d10d5dfa34dce5440bdaf70bc0a7fb476 (diff) | |
download | gcc-df9b545b744190406822ce3f0e4b664256e720b1.tar.gz |
* ipa-pure-const.c (struct funct_state_d): New fields
state_previously_known, looping_previously_known; remove
state_set_in_source.
(analyze_function): Use new fields.
(propagate): Avoid assumption that state_set_in_source imply
nonlooping.
* tree-ssa-loop-niter.c (finite_loop_p): New function.
* tree-ssa-loop-ivcanon.c (empty_loop_p): Use it.
* cfgloop.h (finite_loop_p): Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r-- | gcc/ipa-pure-const.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index c938b0da1c6..9575468ec7c 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -72,7 +72,8 @@ struct funct_state_d /* See above. */ enum pure_const_state_e pure_const_state; /* What user set here; we can be always sure about this. */ - enum pure_const_state_e state_set_in_source; + enum pure_const_state_e state_previously_known; + bool looping_previously_known; /* True if the function could possibly infinite loop. There are a lot of ways that this could be determined. We are pretty @@ -485,7 +486,8 @@ analyze_function (struct cgraph_node *fn, bool ipa) l = XCNEW (struct funct_state_d); l->pure_const_state = IPA_CONST; - l->state_set_in_source = IPA_NEITHER; + l->state_previously_known = IPA_NEITHER; + l->looping_previously_known = true; l->looping = false; l->can_throw = false; @@ -528,17 +530,17 @@ end: if (TREE_READONLY (decl)) { l->pure_const_state = IPA_CONST; - l->state_set_in_source = IPA_CONST; + l->state_previously_known = IPA_CONST; if (!DECL_LOOPING_CONST_OR_PURE_P (decl)) - l->looping = false; + l->looping = false, l->looping_previously_known = false; } if (DECL_PURE_P (decl)) { if (l->pure_const_state != IPA_CONST) l->pure_const_state = IPA_PURE; - l->state_set_in_source = IPA_PURE; + l->state_previously_known = IPA_PURE; if (!DECL_LOOPING_CONST_OR_PURE_P (decl)) - l->looping = false; + l->looping = false, l->looping_previously_known = false; } if (TREE_NOTHROW (decl)) l->can_throw = false; @@ -728,12 +730,11 @@ propagate (void) enum pure_const_state_e this_state = pure_const_state; bool this_looping = looping; - if (w_l->state_set_in_source != IPA_NEITHER) - { - if (this_state > w_l->state_set_in_source) - this_state = w_l->state_set_in_source; - this_looping = false; - } + if (w_l->state_previously_known != IPA_NEITHER + && this_state > w_l->state_previously_known) + this_state = w_l->state_previously_known; + if (!w_l->looping_previously_known) + this_looping = false; /* All nodes within a cycle share the same info. */ w_l->pure_const_state = this_state; |