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
This commit is contained in:
Martin Jambor 2014-05-15 17:04:18 +02:00 committed by Martin Jambor
parent 9d2681a399
commit 8a2256dda3
4 changed files with 52 additions and 4 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -2877,16 +2877,20 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
else if (jfunc->type == IPA_JF_PASS_THROUGH
&& ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
{
if (ici->agg_contents
&& !ipa_get_jf_pass_through_agg_preserved (jfunc))
if ((ici->agg_contents
&& !ipa_get_jf_pass_through_agg_preserved (jfunc))
|| (ici->polymorphic
&& !ipa_get_jf_pass_through_type_preserved (jfunc)))
ici->param_index = -1;
else
ici->param_index = ipa_get_jf_pass_through_formal_id (jfunc);
}
else if (jfunc->type == IPA_JF_ANCESTOR)
{
if (ici->agg_contents
&& !ipa_get_jf_ancestor_agg_preserved (jfunc))
if ((ici->agg_contents
&& !ipa_get_jf_ancestor_agg_preserved (jfunc))
|| (ici->polymorphic
&& !ipa_get_jf_ancestor_type_preserved (jfunc)))
ici->param_index = -1;
else
{

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,33 @@
/* { 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;
}