#include "system.h"
#include "coretypes.h"
#include "tree.h"
+#include "predict.h"
+#include "vec.h"
+#include "hashtab.h"
+#include "hash-set.h"
+#include "machmode.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "input.h"
+#include "function.h"
+#include "dominance.h"
+#include "cfg.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "tree-dfa.h"
#include "tree-pass.h"
#include "gimple-pretty-print.h"
+#include "hash-map.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
+#include "cgraph.h"
+#include "alloc-pool.h"
+#include "ipa-prop.h"
#include "ipa-inline.h"
#include "cfgloop.h"
#include "except.h"
}
}
+/* Return true if target supports alias symbols. */
+
+bool
+sem_item::target_supports_symbol_aliases_p (void)
+{
+#if !defined (ASM_OUTPUT_DEF) || (!defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL))
+ return false;
+#else
+ return true;
+#endif
+}
+
/* Semantic function constructor that uses STACK as bitmap memory stack. */
sem_function::sem_function (bitmap_obstack *stack): sem_item (FUNC, stack),
sem_function::~sem_function ()
{
for (unsigned i = 0; i < bb_sorted.length (); i++)
- free (bb_sorted[i]);
+ delete (bb_sorted[i]);
arg_types.release ();
bb_sizes.release ();
redirect_callers
= (!original_discardable
&& alias->get_availability () > AVAIL_INTERPOSABLE
- && original->get_availability () > AVAIL_INTERPOSABLE);
+ && original->get_availability () > AVAIL_INTERPOSABLE
+ && !alias->instrumented_version);
}
else
{
redirect_callers = false;
}
- if (create_alias && DECL_COMDAT_GROUP (alias->decl))
+ if (create_alias && (DECL_COMDAT_GROUP (alias->decl)
+ || !sem_item::target_supports_symbol_aliases_p ()))
{
create_alias = false;
create_thunk = true;
local_original
= dyn_cast <cgraph_node *> (original->noninterposable_alias ());
+ if (!local_original)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Noninterposable alias cannot be created.\n\n");
+
+ return false;
+ }
+
if (redirect_callers)
{
/* If alias is non-overwritable then
alias->resolve_alias (original);
/* Workaround for PR63566 that forces equal calling convention
- to be used. */
+ to be used. */
alias->local.local = false;
original->local.local = false;
sem_function::init (void)
{
if (in_lto_p)
- get_node ()->get_body ();
+ get_node ()->get_untransformed_body ();
tree fndecl = node->decl;
function *func = DECL_STRUCT_FUNCTION (fndecl);
phi1 = gsi_stmt (si1);
phi2 = gsi_stmt (si2);
+ tree phi_result1 = gimple_phi_result (phi1);
+ tree phi_result2 = gimple_phi_result (phi2);
+
+ if (!m_checker->compare_operand (phi_result1, phi_result2))
+ return return_false_with_msg ("PHI results are different");
+
size1 = gimple_phi_num_args (phi1);
size2 = gimple_phi_num_args (phi2);
{
gcc_assert (alias_item->type == VAR);
+ if (!sem_item::target_supports_symbol_aliases_p ())
+ {
+ if (dump_file)
+ fprintf (dump_file, "Symbol aliases are not supported by target\n\n");
+ return false;
+ }
+
sem_variable *alias_var = static_cast<sem_variable *> (alias_item);
varpool_node *original = get_node ();
alias->analyzed = false;
DECL_INITIAL (alias->decl) = NULL;
+ alias->need_bounds_init = false;
alias->remove_all_references ();
varpool_node::create_alias (alias_var->decl, decl);
if (dump_file)
fprintf (dump_file, "Init called for %u items (%.2f%%).\n", init_called_count,
- 100.0f * init_called_count / m_items.length ());
+ m_items.length () ? 100.0f * init_called_count / m_items.length (): 0.0f);
}
/* Equality function for semantic items is used to subdivide existing
fprintf (dump_file, "Congruent classes before: %u, after: %u\n",
prev_class_count, class_count);
fprintf (dump_file, "Average class size before: %.2f, after: %.2f\n",
- 1.0f * item_count / prev_class_count,
- 1.0f * item_count / class_count);
+ prev_class_count ? 1.0f * item_count / prev_class_count : 0.0f,
+ class_count ? 1.0f * item_count / class_count : 0.0f);
fprintf (dump_file, "Average non-singular class size: %.2f, count: %u\n",
- 1.0f * non_singular_classes_sum / non_singular_classes_count,
+ non_singular_classes_count ? 1.0f * non_singular_classes_sum /
+ non_singular_classes_count : 0.0f,
non_singular_classes_count);
fprintf (dump_file, "Equal symbols: %u\n", equal_items);
fprintf (dump_file, "Fraction of visited symbols: %.2f%%\n\n",
- 100.0f * equal_items / item_count);
+ item_count ? 100.0f * equal_items / item_count : 0.0f);
}
for (hash_table<congruence_class_group_hash>::iterator it = m_classes.begin ();
optimizer->unregister_hooks ();
delete optimizer;
+ optimizer = NULL;
return 0;
}