diff options
author | Martin Jambor <mjambor@suse.cz> | 2014-05-15 17:04:18 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2014-05-15 17:04:18 +0200 |
commit | 8a2256dda3eb92563d08180b8dff95c5a4ec45b7 (patch) | |
tree | 1ad23e964696a4921b49c3f0d117811f3b936342 | |
parent | 9d2681a399507e4a33e95e3f738e7328b8abcc90 (diff) | |
download | gcc-8a2256dda3eb92563d08180b8dff95c5a4ec45b7.zip gcc-8a2256dda3eb92563d08180b8dff95c5a4ec45b7.tar.gz gcc-8a2256dda3eb92563d08180b8dff95c5a4ec45b7.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr61085.C | 33 |
4 files changed, 52 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 960927c..2ddb6dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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 * tree-sra.c (sra_modify_expr): Pass the current gsi to build_ref_for_model. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index f4b9b3b..e372171 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -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 { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a43475..96b6303 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gcc.dg/tree-ssa/pr61090.c: New test. diff --git a/gcc/testsuite/g++.dg/ipa/pr61085.C b/gcc/testsuite/g++.dg/ipa/pr61085.C new file mode 100644 index 0000000..531f59d --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr61085.C @@ -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; +} |