[gcc(refs/users/guojiufu/heads/guojiufu-branch)] c++: Create fewer SAVE_EXPR.
Jiu Fu Guo
guojiufu@gcc.gnu.org
Wed Jun 10 02:54:50 GMT 2020
https://gcc.gnu.org/g:295790712f1168d9d540c240446b167592b77aca
commit 295790712f1168d9d540c240446b167592b77aca
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jan 14 22:55:59 2020 -0500
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.
Diff:
---
gcc/cp/ChangeLog | 5 +++++
gcc/cp/call.c | 7 +++----
2 files changed, 8 insertions(+), 4 deletions(-)
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 <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 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,
More information about the Gcc-cvs
mailing list