Commit 8a2256dd by Martin Jambor Committed by Martin Jambor

re PR ipa/61085 (wrong code with -O2 -fno-early-inlining (maybe wrong devirtualization))

2014-05-15  Martin Jambor  <mjambor@suse.cz>

	PR ipa/61085
	* ipa-prop.c (update_indirect_edges_after_inlining): Check
	type_preserved flag when the indirect edge is polymorphic.

testsuite/
	* g++.dg/ipa/pr61085.C: New test.

From-SVN: r210477
parent 9d2681a3
2014-05-15 Martin Jambor <mjambor@suse.cz> 2014-05-15 Martin Jambor <mjambor@suse.cz>
PR ipa/61085
* ipa-prop.c (update_indirect_edges_after_inlining): Check
type_preserved flag when the indirect edge is polymorphic.
2014-05-15 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/61090 PR tree-optimization/61090
* tree-sra.c (sra_modify_expr): Pass the current gsi to * tree-sra.c (sra_modify_expr): Pass the current gsi to
build_ref_for_model. build_ref_for_model.
......
...@@ -2877,16 +2877,20 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, ...@@ -2877,16 +2877,20 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
else if (jfunc->type == IPA_JF_PASS_THROUGH else if (jfunc->type == IPA_JF_PASS_THROUGH
&& ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR) && ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
{ {
if (ici->agg_contents if ((ici->agg_contents
&& !ipa_get_jf_pass_through_agg_preserved (jfunc)) && !ipa_get_jf_pass_through_agg_preserved (jfunc))
|| (ici->polymorphic
&& !ipa_get_jf_pass_through_type_preserved (jfunc)))
ici->param_index = -1; ici->param_index = -1;
else else
ici->param_index = ipa_get_jf_pass_through_formal_id (jfunc); ici->param_index = ipa_get_jf_pass_through_formal_id (jfunc);
} }
else if (jfunc->type == IPA_JF_ANCESTOR) else if (jfunc->type == IPA_JF_ANCESTOR)
{ {
if (ici->agg_contents if ((ici->agg_contents
&& !ipa_get_jf_ancestor_agg_preserved (jfunc)) && !ipa_get_jf_ancestor_agg_preserved (jfunc))
|| (ici->polymorphic
&& !ipa_get_jf_ancestor_type_preserved (jfunc)))
ici->param_index = -1; ici->param_index = -1;
else else
{ {
......
2014-05-15 Martin Jambor <mjambor@suse.cz> 2014-05-15 Martin Jambor <mjambor@suse.cz>
PR ipa/61085
* g++.dg/ipa/pr61085.C: New test.
2014-05-15 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/61090 PR tree-optimization/61090
* gcc.dg/tree-ssa/pr61090.c: New test. * gcc.dg/tree-ssa/pr61090.c: New test.
......
/* { dg-do run } */
/* { dg-options "-O2 -fno-early-inlining" } */
struct A {};
struct B : virtual A {
unsigned m_i;
B() : m_i () {}
virtual A *m_virt ()
{
return 0;
}
~B ()
{
m_foo ();
while (m_i)
;
}
void m_foo ()
{
m_virt ();
}
};
class C : B {
A *m_virt () {
__builtin_abort ();
}
};
int main ()
{
C c;
}
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