summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-08-26 18:39:26 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-08-26 18:39:26 +0200
commit9e3920e97f0cc9df385cf357f4d123564e0da7ad (patch)
tree4842034f20c95beead33bfbf7d7f7eef7bca0017 /gcc/tree-ssa-dce.c
parent350b70702451004bf3f8b7e520b95728bc98cf28 (diff)
downloadgcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.tar.gz
re PR tree-optimization/44485 (ICE in get_expr_operands, at tree-ssa-operands.c:1020)
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. From-SVN: r163568
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index edec49d374f..a1a51914fa6 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -433,6 +433,7 @@ find_obviously_necessary_stmts (struct edge_list *el)
gimple_stmt_iterator gsi;
edge e;
gimple phi, stmt;
+ int flags;
FOR_EACH_BB (bb)
{
@@ -454,9 +455,8 @@ find_obviously_necessary_stmts (struct edge_list *el)
/* Pure and const functions are finite and thus have no infinite loops in
them. */
- 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))
return;
/* Prevent the empty possibly infinite loops from being removed. */