From: Jason Merrill Date: Wed, 15 Jan 2020 03:55:59 +0000 (-0500) Subject: c++: Create fewer SAVE_EXPR. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=295790712f1168d9d540c240446b167592b77aca;p=gcc.git c++: Create fewer SAVE_EXPR. In a couple of places in build_over_call we were calling cp_stabilize_reference but only using the result once, so it isn't needed. gcc/cp/ChangeLog 2020-05-18 Jason Merrill * call.c (build_over_call): Remove unnecessary cp_stabilize_reference. --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9cd3eb453b..1c4d0657c36 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-05-18 Jason Merrill + + * call.c (build_over_call): Remove unnecessary + cp_stabilize_reference. + 2020-05-18 Marek Polacek * call.c (add_builtin_candidate): Don't create a builtin overload diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b96bc06a364..0b0eaa65ad8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9003,8 +9003,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) else if ((trivial || TREE_CODE (arg) == TARGET_EXPR) && !unsafe) { - tree to = cp_stabilize_reference (cp_build_fold_indirect_ref (fa)); - + tree to = cp_build_fold_indirect_ref (fa); val = build2 (INIT_EXPR, DECL_CONTEXT (fn), to, arg); return val; } @@ -9013,8 +9012,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR) && trivial_fn_p (fn)) { - tree to = cp_stabilize_reference - (cp_build_fold_indirect_ref (argarray[0])); + tree to = cp_build_fold_indirect_ref (argarray[0]); tree type = TREE_TYPE (to); tree as_base = CLASSTYPE_AS_BASE (type); tree arg = argarray[1]; @@ -9043,6 +9041,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) tree array_type, alias_set; arg2 = TYPE_SIZE_UNIT (as_base); + to = cp_stabilize_reference (to); arg0 = cp_build_addr_expr (to, complain); array_type = build_array_type (unsigned_char_type_node,