Commit 27093ee4 by Jason Merrill Committed by Jason Merrill

re PR tree-optimization/62091 (ice in before_dom_children)

	PR tree-optimization/62091
	* decl2.c (decl_needed_p): Return true for virtual functions when
	devirtualizing.

From-SVN: r214181
parent 981ac3c7
2014-08-19 Jason Merrill <jason@redhat.com> 2014-08-19 Jason Merrill <jason@redhat.com>
PR tree-optimization/62091
* decl2.c (decl_needed_p): Return true for virtual functions when
devirtualizing.
PR lto/53808 PR lto/53808
PR c++/61659 PR c++/61659
* decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger * decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger
......
...@@ -1975,6 +1975,11 @@ decl_needed_p (tree decl) ...@@ -1975,6 +1975,11 @@ decl_needed_p (tree decl)
if (flag_keep_inline_dllexport if (flag_keep_inline_dllexport
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl))) && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true; return true;
/* Virtual functions might be needed for devirtualization. */
if (flag_devirtualize
&& TREE_CODE (decl) == FUNCTION_DECL
&& DECL_VIRTUAL_P (decl))
return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent /* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */ reference to DECL might cause it to be emitted later. */
return false; return false;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2 -fdump-tree-ccp1" } */
class SnmpSyntax class SnmpSyntax
{ {
public: public:
...@@ -27,4 +27,5 @@ void fn1 () ...@@ -27,4 +27,5 @@ void fn1 ()
c.m_fn1 (); c.m_fn1 ();
} }
} }
// Devirtualization to A::m_fn1 would be possible, but we can not do it at the moment /* { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
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