+2017-02-03 Martin Liska <mliska@suse.cz>
+
+ PR ipa/79337
+ * ipa-prop.c (ipa_node_params_t::insert): Remove current
+ implementation.
+ (ipa_node_params_t::remove): Likewise.
+ * ipa-prop.h (ipa_node_params::ipa_node_params): Make default
+ initialization from removed ipa_node_params_t::insert.
+ (ipa_node_params::~ipa_node_params): Move from removed
+ ipa_node_params_t::release.
+ * symbol-summary.h (symbol_summary::m_released): New member.
+ Do not release a summary twice. Do not allow to call finalizer
+ for types of a summary that live in GGC memory.
+
2017-02-02 Naveen H.S <Naveen.Hurugalawadi@cavium.com>
* config/aarch64/aarch64.c (thunderx2t99_tunings): Enable AES and
ipa_analyze_node (node);
}
-/* Initialize a newly created param info. */
-
-void
-ipa_node_params_t::insert (cgraph_node *, ipa_node_params *info)
-{
- info->lattices = NULL;
- info->ipcp_orig_node = NULL;
- info->known_csts = vNULL;
- info->known_contexts = vNULL;
- info->analysis_done = 0;
- info->node_enqueued = 0;
- info->do_clone_for_all_contexts = 0;
- info->is_all_contexts_clone = 0;
- info->node_dead = 0;
- info->node_within_scc = 0;
- info->node_calling_single_call = 0;
- info->versionable = 0;
-}
-
-/* Frees all dynamically allocated structures that the param info points
- to. */
-
-void
-ipa_node_params_t::remove (cgraph_node *, ipa_node_params *info)
-{
- free (info->lattices);
- /* Lattice values and their sources are deallocated with their alocation
- pool. */
- info->known_csts.release ();
- info->known_contexts.release ();
-}
-
/* Hook that is called by summary when a node is duplicated. */
void
struct GTY((for_user)) ipa_node_params
{
+ /* Default constructor. */
+ ipa_node_params ();
+
+ /* Default destructor. */
+ ~ipa_node_params ();
+
/* Information about individual formal parameters that are gathered when
summaries are generated. */
vec<ipa_param_descriptor, va_gc> *descriptors;
unsigned versionable : 1;
};
+inline
+ipa_node_params::ipa_node_params ()
+: descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL),
+ known_csts (vNULL), known_contexts (vNULL), analysis_done (0),
+ node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0),
+ node_dead (0), node_within_scc (0), node_calling_single_call (0),
+ versionable (0)
+{
+}
+
+inline
+ipa_node_params::~ipa_node_params ()
+{
+ free (lattices);
+ known_csts.release ();
+ known_contexts.release ();
+}
+
/* Intermediate information that we get from alias analysis about a particular
parameter in a particular basic_block. When a parameter or the memory it
references is marked modified, we use that information in all dominated
ipa_node_params_t (symbol_table *table, bool ggc):
function_summary<ipa_node_params *> (table, ggc) { }
- /* Hook that is called by summary when a node is deleted. */
- virtual void insert (cgraph_node *, ipa_node_params *info);
- /* Hook that is called by summary when a node is deleted. */
- virtual void remove (cgraph_node *, ipa_node_params *info);
/* Hook that is called by summary when a node is duplicated. */
virtual void duplicate (cgraph_node *node,
cgraph_node *node2,
public:
/* Default construction takes SYMTAB as an argument. */
function_summary (symbol_table *symtab, bool ggc = false): m_ggc (ggc),
- m_map (13, ggc), m_insertion_enabled (true), m_symtab (symtab)
+ m_map (13, ggc), m_insertion_enabled (true), m_released (false),
+ m_symtab (symtab)
{
m_symtab_insertion_hook =
symtab->add_cgraph_insertion_hook
/* Destruction method that can be called for GGT purpose. */
void release ()
{
- if (m_symtab_insertion_hook)
- m_symtab->remove_cgraph_insertion_hook (m_symtab_insertion_hook);
+ if (m_released)
+ return;
- if (m_symtab_removal_hook)
- m_symtab->remove_cgraph_removal_hook (m_symtab_removal_hook);
-
- if (m_symtab_duplication_hook)
- m_symtab->remove_cgraph_duplication_hook (m_symtab_duplication_hook);
-
- m_symtab_insertion_hook = NULL;
- m_symtab_removal_hook = NULL;
- m_symtab_duplication_hook = NULL;
+ m_symtab->remove_cgraph_insertion_hook (m_symtab_insertion_hook);
+ m_symtab->remove_cgraph_removal_hook (m_symtab_removal_hook);
+ m_symtab->remove_cgraph_duplication_hook (m_symtab_duplication_hook);
/* Release all summaries. */
typedef typename hash_map <map_hash, T *>::iterator map_iterator;
for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
release ((*it).second);
+
+ m_released = true;
}
/* Traverses all summarys with a function F called with
/* Allocates new data that are stored within map. */
T* allocate_new ()
{
- return m_ggc ? new (ggc_alloc <T> ()) T() : new T () ;
+ /* Call gcc_internal_because we do not want to call finalizer for
+ a type T. We call dtor explicitly. */
+ return m_ggc ? new (ggc_internal_alloc (sizeof (T))) T () : new T () ;
}
/* Release an item that is stored within map. */
cgraph_2node_hook_list *m_symtab_duplication_hook;
/* Indicates if insertion hook is enabled. */
bool m_insertion_enabled;
+ /* Indicates if the summary is released. */
+ bool m_released;
/* Symbol table the summary is registered to. */
symbol_table *m_symtab;