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/calls.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/calls.c')
-rw-r--r-- | gcc/calls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index cd0d9c593f3..c50a79265f0 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -601,7 +601,7 @@ flags_from_decl_or_type (const_tree exp) flags |= ECF_RETURNS_TWICE; /* Process the pure and const attributes. */ - if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) + if (TREE_READONLY (exp)) flags |= ECF_CONST; if (DECL_PURE_P (exp)) flags |= ECF_PURE; @@ -616,11 +616,15 @@ flags_from_decl_or_type (const_tree exp) flags = special_function_p (exp, flags); } - else if (TYPE_P (exp) && TYPE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) + else if (TYPE_P (exp) && TYPE_READONLY (exp)) flags |= ECF_CONST; if (TREE_THIS_VOLATILE (exp)) - flags |= ECF_NORETURN; + { + flags |= ECF_NORETURN; + if (flags & (ECF_CONST|ECF_PURE)) + flags |= ECF_LOOPING_CONST_OR_PURE; + } return flags; } |