From ce3beba3df013a2ebffbde6bf691f396dd968f61 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 19 Aug 2010 13:00:51 -0400 Subject: re PR middle-end/45307 (Stores expanding to no RTL not removed by tree optimizers, Empty ctors/dtors not eliminated) PR c++/45307 * gimplify.c (gimplify_init_constructor): Just return GS_UNHANDLED if ctor is empty. (gimplify_modify_expr_rhs): Adjust. From-SVN: r163380 --- gcc/cp/cp-gimplify.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gcc/cp/cp-gimplify.c') diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index abd5bf3..e5a7f26 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -575,15 +575,18 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) TREE_OPERAND (*expr_p, 1) = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op0), op1); - else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1)) - && !(TREE_CODE (op1) == CALL_EXPR - && CALL_EXPR_RETURN_SLOT_OPT (op1)) + else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1) + || (TREE_CODE (op1) == CONSTRUCTOR + && CONSTRUCTOR_NELTS (op1) == 0) + || (TREE_CODE (op1) == CALL_EXPR + && !CALL_EXPR_RETURN_SLOT_OPT (op1))) && is_really_empty_class (TREE_TYPE (op0))) { /* Remove any copies of empty classes. We check that the RHS - has a simple form so that TARGET_EXPRs and CONSTRUCTORs get - reduced properly, and we leave the return slot optimization - alone because it isn't a copy. + has a simple form so that TARGET_EXPRs and non-empty + CONSTRUCTORs get reduced properly, and we leave the return + slot optimization alone because it isn't a copy (FIXME so it + shouldn't be represented as one). Also drop volatile variables on the RHS to avoid infinite recursion from gimplify_expr trying to load the value. */ -- cgit v1.1