Commit ce3beba3 by Jason Merrill Committed by Jason Merrill

re PR middle-end/45307 (Stores expanding to no RTL not removed by tree…

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
parent 2c5df20f
2010-08-19 Jason Merrill <jason@redhat.com>
PR c++/45307
* gimplify.c (gimplify_init_constructor): Just return GS_UNHANDLED
if ctor is empty.
(gimplify_modify_expr_rhs): Adjust.
2010-08-19 Nathan Froyd <froydnj@codesourcery.com> 2010-08-19 Nathan Froyd <froydnj@codesourcery.com>
* cfgloop.c (get_loop_body_in_bfs_order): Avoid redundant call to * cfgloop.c (get_loop_body_in_bfs_order): Avoid redundant call to
......
2010-08-19 Jason Merrill <jason@redhat.com> 2010-08-19 Jason Merrill <jason@redhat.com>
PR c++/45307
* cp-gimplify.c (cp_gimplify_expr): Also remove assignment
of empty class CONSTRUCTOR.
* except.c (pending_noexcept, pending_noexcept_checks): New. * except.c (pending_noexcept, pending_noexcept_checks): New.
(perform_deferred_noexcept_checks): New. (perform_deferred_noexcept_checks): New.
(maybe_noexcept_warning): Split from... (maybe_noexcept_warning): Split from...
......
...@@ -575,15 +575,18 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) ...@@ -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_OPERAND (*expr_p, 1) = build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (op0), op1); TREE_TYPE (op0), op1);
else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1)) else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1)
&& !(TREE_CODE (op1) == CALL_EXPR || (TREE_CODE (op1) == CONSTRUCTOR
&& CALL_EXPR_RETURN_SLOT_OPT (op1)) && CONSTRUCTOR_NELTS (op1) == 0)
|| (TREE_CODE (op1) == CALL_EXPR
&& !CALL_EXPR_RETURN_SLOT_OPT (op1)))
&& is_really_empty_class (TREE_TYPE (op0))) && is_really_empty_class (TREE_TYPE (op0)))
{ {
/* Remove any copies of empty classes. We check that the RHS /* Remove any copies of empty classes. We check that the RHS
has a simple form so that TARGET_EXPRs and CONSTRUCTORs get has a simple form so that TARGET_EXPRs and non-empty
reduced properly, and we leave the return slot optimization CONSTRUCTORs get reduced properly, and we leave the return
alone because it isn't a copy. 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 Also drop volatile variables on the RHS to avoid infinite
recursion from gimplify_expr trying to load the value. */ recursion from gimplify_expr trying to load the value. */
......
...@@ -4237,6 +4237,10 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, ...@@ -4237,6 +4237,10 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p,
break; break;
case CONSTRUCTOR: case CONSTRUCTOR:
/* If we already made some changes, let the front end have a
crack at this before we break it down. */
if (ret != GS_UNHANDLED)
break;
/* If we're initializing from a CONSTRUCTOR, break this into /* If we're initializing from a CONSTRUCTOR, break this into
individual MODIFY_EXPRs. */ individual MODIFY_EXPRs. */
return gimplify_init_constructor (expr_p, pre_p, post_p, want_value, return gimplify_init_constructor (expr_p, pre_p, post_p, want_value,
......
2010-08-19 Jason Merrill <jason@redhat.com> 2010-08-19 Jason Merrill <jason@redhat.com>
* g++.dg/tree-ssa/empty-2.C: New.
* g++.dg/cpp0x/noexcept09.C: New. * g++.dg/cpp0x/noexcept09.C: New.
2010-08-19 Daniel Kraft <d@domob.eu> 2010-08-19 Daniel Kraft <d@domob.eu>
......
// PR c++/45307
// { dg-options -fdump-tree-gimple }
struct fallible_t { };
const fallible_t fallible = fallible_t();
// { dg-final { scan-tree-dump-not "fallible" "gimple" } }
// { dg-final { cleanup-tree-dump "gimple" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment