diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-26 16:39:26 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-26 16:39:26 +0000 |
commit | 67fa407877f98e6b8043be20f3ed38c7540b1fb0 (patch) | |
tree | 4842034f20c95beead33bfbf7d7f7eef7bca0017 /gcc/tree-ssa-loop-niter.c | |
parent | ee795767523780a41f75911751fe0e589e05b34b (diff) | |
download | gcc-67fa407877f98e6b8043be20f3ed38c7540b1fb0.tar.gz |
PR tree-optimization/44485
* calls.c (flags_from_decl_or_type): For const or pure
noreturn functions return ECF_LOOPING_CONST_OR_PURE|ECF_NORETURN
together with ECF_CONST resp. ECF_PURE.
* builtins.c (expand_builtin): Use flags_from_decl_or_type
instead of querying flags directly.
* tree-ssa-loop-niter.c (finite_loop_p): Likewise.
* tree-ssa-dce.c (find_obviously_necessary_stmts): Likewise.
* gcc.dg/pr44485.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163568 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 2630faf02fa..d23592dfa53 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1970,12 +1970,12 @@ finite_loop_p (struct loop *loop) edge ex; struct tree_niter_desc desc; bool finite = false; + int flags; if (flag_unsafe_loop_optimizations) return true; - if ((TREE_READONLY (current_function_decl) - || DECL_PURE_P (current_function_decl)) - && !DECL_LOOPING_CONST_OR_PURE_P (current_function_decl)) + flags = flags_from_decl_or_type (current_function_decl); + if ((flags & (ECF_CONST|ECF_PURE)) && !(flags & ECF_LOOPING_CONST_OR_PURE)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Found loop %i to be finite: it is within pure or const function.\n", |