diff options
author | Jason Merrill <jason@redhat.com> | 2020-01-14 22:55:59 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-05-18 16:17:59 -0400 |
commit | 295790712f1168d9d540c240446b167592b77aca (patch) | |
tree | 9c79dbbee2ee788a030e7a8d5d53e47ca38adfd7 /gcc | |
parent | 100fdb1f09b484ef100b638b28a260857d85f9dd (diff) | |
download | gcc-295790712f1168d9d540c240446b167592b77aca.zip gcc-295790712f1168d9d540c240446b167592b77aca.tar.gz gcc-295790712f1168d9d540c240446b167592b77aca.tar.bz2 |
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 <jason@redhat.com>
* call.c (build_over_call): Remove unnecessary
cp_stabilize_reference.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9cd3eb..1c4d065 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-05-18 Jason Merrill <jason@redhat.com> + + * call.c (build_over_call): Remove unnecessary + cp_stabilize_reference. + 2020-05-18 Marek Polacek <polacek@redhat.com> * call.c (add_builtin_candidate): Don't create a builtin overload diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b96bc06..0b0eaa6 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, |