diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-19 18:25:45 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-19 18:25:45 +0000 |
commit | 9af43b990708ab0db5dff2a97912127efac7994d (patch) | |
tree | 56892d19137aa0a96badc189ed7f577a12b9794f /gcc/cp/decl2.c | |
parent | c781374e6e08121c8ab1fc7392482e02da0f8668 (diff) | |
download | gcc-9af43b990708ab0db5dff2a97912127efac7994d.tar.gz |
PR tree-optimization/62091
* decl2.c (decl_needed_p): Return true for virtual functions when
devirtualizing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214181 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index de28cb712c3..63583a8dc6a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1975,6 +1975,11 @@ decl_needed_p (tree decl) if (flag_keep_inline_dllexport && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl))) 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 reference to DECL might cause it to be emitted later. */ return false; |