diff options
author | Richard Biener <rguenther@suse.de> | 2021-04-14 13:40:58 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-04-26 10:08:46 +0200 |
commit | 52a5515ed6619739eb122f05ce26057dd8b06fb6 (patch) | |
tree | ce23cf5cca7daae1d47e61007eccfdbfe862fe13 /gcc/tree-ssa-strlen.c | |
parent | 297bfacdb448c0d29b8dfac2818350b90902bc75 (diff) | |
download | gcc-52a5515ed6619739eb122f05ce26057dd8b06fb6.zip gcc-52a5515ed6619739eb122f05ce26057dd8b06fb6.tar.gz gcc-52a5515ed6619739eb122f05ce26057dd8b06fb6.tar.bz2 |
Simplify {gimplify_and_,}update_call_from_tree API
This removes update_call_from_tree in favor of
gimplify_and_update_call_from_tree, removing some code duplication
and simplifying the API use. Some users of update_call_from_tree
have been transitioned to replace_call_with_value and the API
and its dependences have been moved to gimple-fold.h.
This shaves off another user of valid_gimple_rhs_p which is now
only used from within gimple-fold.c and thus moved and made private.
2021-04-14 Richard Biener <rguenther@suse.de>
* tree-ssa-propagate.h (valid_gimple_rhs_p): Remove.
(update_gimple_call): Likewise.
(update_call_from_tree): Likewise.
* tree-ssa-propagate.c (valid_gimple_rhs_p): Remove.
(valid_gimple_call_p): Likewise.
(move_ssa_defining_stmt_for_defs): Likewise.
(finish_update_gimple_call): Likewise.
(update_gimple_call): Likewise.
(update_call_from_tree): Likewise.
(propagate_tree_value_into_stmt): Use replace_call_with_value.
* gimple-fold.h (update_gimple_call): Declare.
* gimple-fold.c (valid_gimple_rhs_p): Move here from
tree-ssa-propagate.c.
(update_gimple_call): Likewise.
(valid_gimple_call_p): Likewise.
(finish_update_gimple_call): Likewise, and simplify.
(gimplify_and_update_call_from_tree): Implement
update_call_from_tree functionality, avoid excessive
push/pop_gimplify_context.
(gimple_fold_builtin): Use only gimplify_and_update_call_from_tree.
(gimple_fold_call): Likewise.
* gimple-ssa-sprintf.c (try_substitute_return_value): Likewise.
* tree-ssa-ccp.c (ccp_folder::fold_stmt): Likewise.
(pass_fold_builtins::execute): Likewise.
(optimize_stack_restore): Use replace_call_with_value.
* tree-cfg.c (fold_loop_internal_call): Likewise.
* tree-ssa-dce.c (maybe_optimize_arith_overflow): Use
only gimplify_and_update_call_from_tree.
* tree-ssa-strlen.c (handle_builtin_strlen): Likewise.
(handle_builtin_strchr): Likewise.
* tsan.c: Include gimple-fold.h instead of tree-ssa-propagate.h.
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_builtin):
Use replace_call_with_value.
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index cccd4a0..c7b5e2c 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -2158,8 +2158,7 @@ handle_builtin_strlen (gimple_stmt_iterator *gsi) if (bound) rhs = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (rhs), rhs, bound); - if (!update_call_from_tree (gsi, rhs)) - gimplify_and_update_call_from_tree (gsi, rhs); + gimplify_and_update_call_from_tree (gsi, rhs); stmt = gsi_stmt (*gsi); update_stmt (stmt); if (dump_file && (dump_flags & TDF_DETAILS) != 0) @@ -2258,8 +2257,7 @@ handle_builtin_strlen (gimple_stmt_iterator *gsi) } if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (ret))) ret = fold_convert_loc (loc, TREE_TYPE (lhs), ret); - if (!update_call_from_tree (gsi, ret)) - gimplify_and_update_call_from_tree (gsi, ret); + gimplify_and_update_call_from_tree (gsi, ret); stmt = gsi_stmt (*gsi); update_stmt (stmt); if (dump_file && (dump_flags & TDF_DETAILS) != 0) @@ -2337,8 +2335,7 @@ handle_builtin_strchr (gimple_stmt_iterator *gsi) TREE_TYPE (rhs))) rhs = fold_convert_loc (loc, TREE_TYPE (lhs), rhs); } - if (!update_call_from_tree (gsi, rhs)) - gimplify_and_update_call_from_tree (gsi, rhs); + gimplify_and_update_call_from_tree (gsi, rhs); stmt = gsi_stmt (*gsi); update_stmt (stmt); if (dump_file && (dump_flags & TDF_DETAILS) != 0) |