--- /dev/null
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-options "-O -Wuninitialized" }
+
+#include <vector>
+
+struct Camera {
+ struct P2d {
+ float x, y;
+ };
+ std::vector<P2d> clip_area;
+ float border = 10.f;
+ [[gnu::noinline]] Camera() : clip_area({{border,border}}) { } // { dg-warning "uninitialized" }
+};
+
+Camera foo()
+{
+ Camera c;
+ return c;
+}
}
}
+/* Remove indirect clobbers. */
+
+static void
+remove_indirect_clobbers (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ if (gimple_clobber_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if (TREE_CODE (lhs) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME)
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
+ continue;
+ }
+ }
+ gsi_next (&gsi);
+ }
+}
+
/* Free all memory associated with going out of SSA form. SA is
the outof-SSA info object. */
unsigned int
rewrite_out_of_ssa (struct ssaexpand *sa)
{
+ /* Remove remaining indirect clobbers as we do not need those anymore.
+ Those might extend SSA lifetime and restrict coalescing. */
+ remove_indirect_clobbers ();
+
/* If elimination of a PHI requires inserting a copy on a backedge,
then we will have to split the backedge which has numerous
undesirable performance effects.
copies into the loop itself. */
insert_backedge_copies ();
-
/* Eliminate PHIs which are of no use, such as virtual or dead phis. */
eliminate_useless_phis ();
if (gimple_code (stmt) != GIMPLE_CALL)
{
- /* Remove all *ssaname_N ={v} {CLOBBER}; stmts,
- after the last GIMPLE DSE they aren't needed and might
- unnecessarily keep the SSA_NAMEs live. */
- if (gimple_clobber_p (stmt))
- {
- tree lhs = gimple_assign_lhs (stmt);
- if (TREE_CODE (lhs) == MEM_REF
- && TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME)
- {
- unlink_stmt_vdef (stmt);
- gsi_remove (&i, true);
- release_defs (stmt);
- continue;
- }
- }
- else if (gimple_assign_load_p (stmt) && gimple_store_p (stmt))
+ if (gimple_assign_load_p (stmt) && gimple_store_p (stmt))
optimize_memcpy (&i, gimple_assign_lhs (stmt),
gimple_assign_rhs1 (stmt), NULL_TREE);
gsi_next (&i);