diff options
author | Michael Matz <matz@suse.de> | 2009-09-28 12:54:23 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2009-09-28 12:54:23 +0000 |
commit | 44e10129de2232d8e910e2c12140b80b74799586 (patch) | |
tree | d0d5ddfb1d852abf4f125c9e24309f475790c349 /gcc/tree-ssa-dom.c | |
parent | d813aaba522c350e5f22ac1d1346b83766ac55f2 (diff) | |
download | gcc-44e10129de2232d8e910e2c12140b80b74799586.zip gcc-44e10129de2232d8e910e2c12140b80b74799586.tar.gz gcc-44e10129de2232d8e910e2c12140b80b74799586.tar.bz2 |
builtins.c (interclass_mathfn_icode): New helper.
* 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.
From-SVN: r152236
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 067a911..05a8d92 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2133,6 +2133,20 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si) { eliminate_redundant_computations (&si); stmt = gsi_stmt (si); + if (gimple_code (stmt) == GIMPLE_CALL) + { + /* Resolve __builtin_constant_p. If it hasn't been + folded to integer_one_node by now, it's fairly + certain that the value simply isn't constant. */ + tree callee = gimple_call_fndecl (stmt); + if (callee + && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL + && DECL_FUNCTION_CODE (callee) == BUILT_IN_CONSTANT_P) + { + propagate_tree_value_into_stmt (&si, integer_zero_node); + stmt = gsi_stmt (si); + } + } } /* Record any additional equivalences created by this statement. */ |