summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-28 12:54:23 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-28 12:54:23 +0000
commita65c4d644bc63c7e9ed0df60898aac5aff8cc60c (patch)
treed0d5ddfb1d852abf4f125c9e24309f475790c349 /gcc/tree-ssa-ccp.c
parentf5417e320113d343ff34f0e82f9130d779d2a065 (diff)
downloadgcc-a65c4d644bc63c7e9ed0df60898aac5aff8cc60c.tar.gz
* builtins.c (interclass_mathfn_icode): New helper.
(expand_builtin_interclass_mathfn): Use it here, and split folding into ... (fold_builtin_interclass_mathfn): ... this new folder. (build_call_nofold_loc): New static helper. (build_call_nofold): New wrapper macro for above. (expand_builtin_int_roundingfn): Use it instead of build_call_expr. (expand_builtin_pow): Ditto. (expand_builtin_memset_args): Ditto. (expand_builtin_printf): Ditto. (expand_builtin_fprintf): Ditto. (expand_builtin_sprintf): Ditto. (expand_builtin_memory_chk): Ditto. (expand_builtin_mempcpy_args): Ditto and don't call folders. (expand_builtin_stpcpy): Ditto. (expand_builtin_strcmp): Ditto. (expand_builtin_strncmp): Ditto. (expand_builtin_strcpy): Remove FNDECL and MODE arguments. (expand_builtin_strcpy_args): Don't call folders. (expand_builtin_memcmp): Ditto. (expand_builtin_strncpy): Ditto, and use target. (expand_builtin_memcpy): Ditto. (expand_builtin_strstr, expand_builtin_strchr, expand_builtin_strrchr, expand_builtin_strpbrk, expand_builtin_memmove, expand_builtin_memmove_args, expand_builtin_bcopy, expand_builtin_memchr, expand_builtin_strcat, expand_builtin_strncat, expand_builtin_strspn, expand_builtin_strcspn, expand_builtin_fputs): Remove these. (expand_builtin): Don't call the above, change calls to other expanders that changed prototype. (fold_builtin_stpcpy): New folder split out from expand_builtin_stpcpy. (fold_builtin_1 <ISFINITE, ISINF, ISNORMAL>): Call fold_builtin_interclass_mathfn. (fold_builtin_2 <STPCPY>): Call fold_builtin_stpcpy. (fold_builtin_strcat): Add folding split from expand_builtin_strcat. * fold-const.c (fold_binary_loc <NE_EXPR>): Add !exp != 0 -> !exp. * passes.c (init_optimization_passes): Move pass_fold_builtins after last phiopt pass. * tree-inline.c (fold_marked_statements): When folding builtins iterate over all instruction potentially generated. * tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Declare earlier. (fold_gimple_call): Use it to always fold calls (into potentially multiple instructions). * tree-ssa-dom.c (optimize_stmt): Resolve __builtin_constant_p calls into zero at this time. * tree-ssa-propagate.c (substitute_and_fold): Ignore multiple statements generated by builtin folding. testsuite/ * gcc.dg/builtins-44.c: Use __builtin_isinf_sign when checking for sign of -Inf. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152236 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 85159b2bacf..76ea0e49e1c 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1424,8 +1424,8 @@ evaluate_stmt (gimple stmt)
else if (code == GIMPLE_SWITCH)
simplified = gimple_switch_index (stmt);
else
- /* These cannot satisfy is_gimple_min_invariant without folding. */
- gcc_assert (code == GIMPLE_CALL || code == GIMPLE_COND);
+ /* These cannot satisfy is_gimple_min_invariant without folding. */
+ gcc_assert (code == GIMPLE_CALL || code == GIMPLE_COND);
}
is_constant = simplified && is_gimple_min_invariant (simplified);
@@ -2895,6 +2895,7 @@ fold_gimple_cond (gimple stmt)
return false;
}
+static void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
/* Attempt to fold a call statement referenced by the statement iterator GSI.
The statement may be replaced by another statement, e.g., if the call
@@ -2915,7 +2916,11 @@ fold_gimple_call (gimple_stmt_iterator *gsi)
tree result = ccp_fold_builtin (stmt);
if (result)
- return update_call_from_tree (gsi, result);
+ {
+ if (!update_call_from_tree (gsi, result))
+ gimplify_and_update_call_from_tree (gsi, result);
+ return true;
+ }
}
else
{