aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.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/builtins.c
parent350b70702451004bf3f8b7e520b95728bc98cf28 (diff)
downloadgcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.zip
gcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.tar.gz
gcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.tar.bz2
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/builtins.c')
-rw-r--r--gcc/builtins.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e8974e1..6d755a1 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5748,6 +5748,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
tree fndecl = get_callee_fndecl (exp);
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
enum machine_mode target_mode = TYPE_MODE (TREE_TYPE (exp));
+ int flags;
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
@@ -5770,8 +5771,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
none of its arguments are volatile, we can avoid expanding the
built-in call and just evaluate the arguments for side-effects. */
if (target == const0_rtx
- && (DECL_PURE_P (fndecl) || TREE_READONLY (fndecl))
- && !DECL_LOOPING_CONST_OR_PURE_P (fndecl))
+ && ((flags = flags_from_decl_or_type (fndecl)) & (ECF_CONST | ECF_PURE))
+ && !(flags & ECF_LOOPING_CONST_OR_PURE))
{
bool volatilep = false;
tree arg;