diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-28 12:54:23 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-28 12:54:23 +0000 |
commit | a65c4d644bc63c7e9ed0df60898aac5aff8cc60c (patch) | |
tree | d0d5ddfb1d852abf4f125c9e24309f475790c349 /gcc/tree-ssa-propagate.c | |
parent | f5417e320113d343ff34f0e82f9130d779d2a065 (diff) | |
download | gcc-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-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index ec0ecf3d3bb..14912388581 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -1001,6 +1001,10 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) gimple stmt = gsi_stmt (i); gimple old_stmt; enum gimple_code code = gimple_code (stmt); + gimple_stmt_iterator oldi; + + oldi = i; + gsi_prev (&i); /* Ignore ASSERT_EXPRs. They are used by VRP to generate range information for names and they are discarded @@ -1008,10 +1012,7 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) if (code == GIMPLE_ASSIGN && TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR) - { - gsi_prev (&i); - continue; - } + continue; /* No point propagating into a stmt whose result is not used, but instead we might be able to remove a trivially dead stmt. */ @@ -1030,7 +1031,6 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) fprintf (dump_file, "\n"); } prop_stats.num_dce++; - gsi_prev (&i); i2 = gsi_for_stmt (stmt); gsi_remove (&i2, true); release_defs (stmt); @@ -1052,7 +1052,7 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) specific information. Do this before propagating into the stmt to not disturb pass specific information. */ if (fold_fn - && (*fold_fn)(&i)) + && (*fold_fn)(&oldi)) { did_replace = true; prop_stats.num_stmts_folded++; @@ -1066,12 +1066,12 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) /* If we made a replacement, fold the statement. */ if (did_replace) - fold_stmt (&i); + fold_stmt (&oldi); /* Now cleanup. */ if (did_replace) { - stmt = gsi_stmt (i); + stmt = gsi_stmt (oldi); /* If we cleaned up EH information from the statement, remove EH edges. */ @@ -1105,8 +1105,6 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) else fprintf (dump_file, "Not folded\n"); } - - gsi_prev (&i); } } |