diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-24 18:32:14 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-24 18:32:14 +0000 |
commit | dcccac3e9a1450221b44ffb52283e564b6331077 (patch) | |
tree | 32a1c1c8f49361c3502e6adb07259b9929277da2 /gcc/ipa-pure-const.c | |
parent | 220692e419b3eb5e2a7b7b39cc1369a4247eb487 (diff) | |
download | gcc-dcccac3e9a1450221b44ffb52283e564b6331077.tar.gz |
2006-11-24 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/29964
* ipa-pure-const.c (check_tree): If the original tree
is volatile return early and say the function is not pure
nor const. Remove the volatile check for writes.
(analyze_function): Print out the result of the local
analysis pass.
2006-11-24 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/29964
* gcc.dg/pure-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119162 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r-- | gcc/ipa-pure-const.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 041cf2984b1..fdaff50d573 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -166,6 +166,14 @@ check_tree (funct_state local, tree t, bool checking_write) if ((TREE_CODE (t) == EXC_PTR_EXPR) || (TREE_CODE (t) == FILTER_EXPR)) return; + /* Any tree which is volatile disqualifies thie function from being + const or pure. */ + if (TREE_THIS_VOLATILE (t)) + { + local->pure_const_state = IPA_NEITHER; + return; + } + while (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR || handled_component_p (t)) @@ -183,12 +191,13 @@ check_tree (funct_state local, tree t, bool checking_write) /* Any indirect reference that occurs on the lhs disqualifies the function from being pure or const. Any - indirect reference to a volatile disqualifies the - function from being pure or const. Any indirect - reference that occurs on the rhs disqualifies the + indirect reference that occurs on the rhs disqualifies the function from being const. */ - if (checking_write || TREE_THIS_VOLATILE (t)) - local->pure_const_state = IPA_NEITHER; + if (checking_write) + { + local->pure_const_state = IPA_NEITHER; + return; + } else if (local->pure_const_state == IPA_CONST) local->pure_const_state = IPA_PURE; } @@ -541,7 +550,7 @@ analyze_function (struct cgraph_node *fn) walk_tree (bsi_stmt_ptr (bsi), scan_function, fn, visited_nodes); if (l->pure_const_state == IPA_NEITHER) - return; + goto end; } } @@ -568,6 +577,14 @@ analyze_function (struct cgraph_node *fn) pop_cfun (); } } + +end: + if (dump_file) + { + fprintf (dump_file, "after local analysis of %s with initial value = %d\n ", + cgraph_node_name (fn), + l->pure_const_state); + } } |