* tree-inline.c (copy_phis_for_bb): If PHI arg substitution creates
!is_gimple_val PHI argument, gimplify it and insert it on edge.
* g++.dg/opt/inline12.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129921
138bc75d-0d04-0410-961f-
82ee72b054a4
2007-11-06 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/33458
+ * tree-inline.c (copy_phis_for_bb): If PHI arg substitution creates
+ !is_gimple_val PHI argument, gimplify it and insert it on edge.
+
PR tree-optimization/33993
* tree-vect-transform.c (vect_get_constant_vectors): Use build_vector
rather than build_constructor_from_list if all list values are
2007-11-06 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/33458
+ * g++.dg/opt/inline12.C: New test.
+
PR tree-optimization/33993
* gcc.c-torture/compile/20071105-1.c: New test.
--- /dev/null
+// PR tree-optimization/33458
+// { dg-do compile }
+// { dg-options "-O" }
+
+inline void
+foo (int *p, int n)
+{
+ for (; n > 0; --n, ++p)
+ *p = 0;
+}
+
+struct A
+{
+ int x[2];
+ A () { foo (x, 2); }
+};
+
+inline A
+getA ()
+{
+ return A ();
+}
+
+struct B
+{
+ A a;
+ B ();
+};
+
+B::B () : a (getA ())
+{
+}
walk_tree (&new_arg, copy_body_r, id, NULL);
gcc_assert (new_arg);
+ /* With return slot optimization we can end up with
+ non-gimple (foo *)&this->m, fix that here. */
+ if (TREE_CODE (new_arg) != SSA_NAME
+ && TREE_CODE (new_arg) != FUNCTION_DECL
+ && !is_gimple_val (new_arg))
+ {
+ tree stmts = NULL_TREE;
+ new_arg = force_gimple_operand (new_arg, &stmts,
+ true, NULL);
+ bsi_insert_on_edge_immediate (new_edge, stmts);
+ }
add_phi_arg (new_phi, new_arg, new_edge);
}
}