Commit c5ad2433 by Martin Liska

Handle PHI nodes w/o a argument (PR ipa/80205).

2017-03-28  Martin Liska  <mliska@suse.cz>

	PR ipa/80205
	* g++.dg/ipa/pr80205.C: New test.
2017-03-28  Richard Biener  <rguenther@suse.de>

	PR ipa/80205
	* tree-inline.c (copy_phis_for_bb): Do not create PHI node
	without arguments, generate default definition of a SSA name.

From-SVN: r246530
parent 17722fb9
2017-03-28 Richard Biener <rguenther@suse.de>
PR ipa/80205
* tree-inline.c (copy_phis_for_bb): Do not create PHI node
without arguments, generate default definition of a SSA name.
2017-03-28 Richard Biener <rguenther@suse.de>
PR middle-end/80222
* gimple-fold.c (gimple_fold_indirect_ref): Do not touch
TYPE_REF_CAN_ALIAS_ALL references.
......
2017-03-28 Martin Liska <mliska@suse.cz>
PR ipa/80205
* g++.dg/ipa/pr80205.C: New test.
2017-03-28 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.c-torture/execute/pr79121.c:Use __{U}INT32_TYPE__ for targets
......
// PR ipa/80205
// { dg-options "-fnon-call-exceptions --param early-inlining-insns=100 -O2" }
class a
{
public:
virtual ~a ();
};
class b
{
public:
template <typename c> b (c);
~b () { delete d; }
void
operator= (b e)
{
b (e).f (*this);
}
void
f (b &e)
{
a g;
d = e.d;
e.d = &g;
}
a *d;
};
void
h ()
{
b i = int();
void j ();
i = j;
}
......@@ -2344,18 +2344,26 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
if (!virtual_operand_p (res))
{
walk_tree (&new_res, copy_tree_body_r, id, NULL);
if (EDGE_COUNT (new_bb->preds) == 0)
{
/* Technically we'd want a SSA_DEFAULT_DEF here... */
SSA_NAME_DEF_STMT (new_res) = gimple_build_nop ();
}
else
{
new_phi = create_phi_node (new_res, new_bb);
FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
{
edge old_edge = find_edge ((basic_block) new_edge->src->aux, bb);
edge old_edge = find_edge ((basic_block) new_edge->src->aux,
bb);
tree arg;
tree new_arg;
edge_iterator ei2;
location_t locus;
/* When doing partial cloning, we allow PHIs on the entry block
as long as all the arguments are the same. Find any input
edge to see argument to copy. */
/* When doing partial cloning, we allow PHIs on the entry
block as long as all the arguments are the same.
Find any input edge to see argument to copy. */
if (!old_edge)
FOR_EACH_EDGE (old_edge, ei2, bb->preds)
if (!old_edge->src->aux)
......@@ -2372,7 +2380,8 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
&& !is_gimple_val (new_arg))
{
gimple_seq stmts = NULL;
new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
new_arg = force_gimple_operand (new_arg, &stmts, true,
NULL);
gsi_insert_seq_on_edge (new_edge, stmts);
inserted = true;
}
......@@ -2391,6 +2400,7 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
}
}
}
}
/* Commit the delayed edge insertions. */
if (inserted)
......
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