diff options
author | Jason Merrill <jason@redhat.com> | 2019-10-17 15:09:53 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-10-17 15:09:53 -0400 |
commit | 8e5993e236a50ffc161dd45d1ef3ab86133e3363 (patch) | |
tree | c5450036b286821b43db98f6d8a071af778b76bf /gcc/gimplify.c | |
parent | c11cccc0285f02f117a1e80924fb7673b6486ce9 (diff) | |
download | gcc-8e5993e236a50ffc161dd45d1ef3ab86133e3363.zip gcc-8e5993e236a50ffc161dd45d1ef3ab86133e3363.tar.gz gcc-8e5993e236a50ffc161dd45d1ef3ab86133e3363.tar.bz2 |
cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
* cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
The comment for get_formal_tmp_var says that it shouldn't be used for
expressions whose value might change between initialization and use, and in
this case we're creating a temporary precisely because the value might
change, so we should use get_initialized_tmp_var instead.
I also noticed that many callers of get_initialized_tmp_var pass NULL for
post_p, so it seems appropriate to make it a default argument.
gcc/
* gimplify.h (get_initialized_tmp_var): Add default argument to
post_p.
* gimplify.c (gimplify_self_mod_expr, gimplify_omp_atomic): Remove
NULL post_p argument.
* targhooks (std_gimplify_va_arg_expr): Likewise.
From-SVN: r277128
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8367069..914bb8e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -661,8 +661,9 @@ get_formal_tmp_var (tree val, gimple_seq *pre_p) are as in gimplify_expr. */ tree -get_initialized_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p, - bool allow_ssa) +get_initialized_tmp_var (tree val, gimple_seq *pre_p, + gimple_seq *post_p /* = NULL */, + bool allow_ssa /* = true */) { return internal_get_tmp_var (val, pre_p, post_p, false, allow_ssa); } @@ -3149,7 +3150,7 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (ret == GS_ERROR) return ret; - lhs = get_initialized_tmp_var (lhs, pre_p, NULL); + lhs = get_initialized_tmp_var (lhs, pre_p); } /* For POINTERs increment, use POINTER_PLUS_EXPR. */ @@ -12688,7 +12689,7 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p) tree bitsize; tree tmp_store = tmp_load; if (TREE_CODE (*expr_p) == OMP_ATOMIC_CAPTURE_OLD) - tmp_store = get_initialized_tmp_var (tmp_load, pre_p, NULL); + tmp_store = get_initialized_tmp_var (tmp_load, pre_p); if (INTEGRAL_TYPE_P (TREE_TYPE (op1))) bitsize = bitsize_int (TYPE_PRECISION (TREE_TYPE (op1))); else |