Commit b16650ac by Jan Hubicka Committed by Jan Hubicka

ipa-icf-32.c: Update template.


	* gcc.dg/ipa/ipa-icf-32.c: Update template.
	* c-c++-common/asan/instrument-with-calls-3.c: Likewise.
	* c-c++-common/asan/instrument-with-calls-2.c: Likewise.
	* c-c++-common/asan/instrument-with-calls-1.c: Likewise.
	* c-c++-common/asan/kasan-recover-1.c: Likewise.
	* c-c++-common/asan/kasan-recover-2.c: Likewise.

	* ipa-reference.c (set_reference_optimization_summary,
	ipa_reference_get_not_written_global): Do nothing if ipa-reference is disabled.
	(ignore_module_statics): New static var.
	(propagate_bits): If ipa-reference is disabled, do not look into local properties.
	(analyze_function): Disable analysis when ipa_reference is disabled.
	(generate_summary): Do not dump when reference is disabled;
	collect vars accessed from functions with ipa-reference disabled.
	(get_read_write_all_from_node): When ipa-reference is disabled, use the
	node flags.
	(gate): Enable for LTO.
	(ignore_edge_p): New function.
	(propagate): Skip functions w/o ipa-reference analysis.
	* optc-save-gen.awk: Handle optimize_debug correctly.
	* opth-gen.awk: Likewise.
	* common.opt (fauto-inc-dec, fdelete-dead-exceptions, ffunction-cse,
	fgraphite, fstrict-volatile-bitfields, fira-algorithm, fira-region,
	fira-share-save-slots, fira-share-spill-slots,
	fmodulo-sched-allow-regmoves, fpartial-inlining,
	sched-stalled-insns, fsched-stalled-insns-dep, fstrict-overflow,
	ftracer, ftree-parallelize-loops, fassociative-math,
	freciprocal-math, fvect-cost-model, fsimd-cost-model): Mark as
	Optimization
	(fauto-profile, fcommon, fdata-sections, fipa-icf-variables,
        ftoplevel-reorder, funit-at-a-time, fwhole-program): Do not mark as
        Optimization.
	* ipa-icf.c (gate, sem_item_optimizer::filter_removed_items):
	Fix for IPA.

From-SVN: r219823
parent 33c3b6be
2015-01-18 Jan Hubicka <hubicka@ucw.cz> 2015-01-18 Jan Hubicka <hubicka@ucw.cz>
* ipa-reference.c (set_reference_optimization_summary,
ipa_reference_get_not_written_global): Do nothing if ipa-reference is disabled.
(ignore_module_statics): New static var.
(propagate_bits): If ipa-reference is disabled, do not look into local properties.
(analyze_function): Disable analysis when ipa_reference is disabled.
(generate_summary): Do not dump when reference is disabled;
collect vars accessed from functions with ipa-reference disabled.
(get_read_write_all_from_node): When ipa-reference is disabled, use the
node flags.
(gate): Enable for LTO.
(ignore_edge_p): New function.
(propagate): Skip functions w/o ipa-reference analysis.
* optc-save-gen.awk: Handle optimize_debug correctly.
* opth-gen.awk: Likewise.
* common.opt (fauto-inc-dec, fdelete-dead-exceptions, ffunction-cse,
fgraphite, fstrict-volatile-bitfields, fira-algorithm, fira-region,
fira-share-save-slots, fira-share-spill-slots,
fmodulo-sched-allow-regmoves, fpartial-inlining,
sched-stalled-insns, fsched-stalled-insns-dep, fstrict-overflow,
ftracer, ftree-parallelize-loops, fassociative-math,
freciprocal-math, fvect-cost-model, fsimd-cost-model): Mark as
Optimization
(fauto-profile, fcommon, fdata-sections, fipa-icf-variables,
ftoplevel-reorder, funit-at-a-time, fwhole-program): Do not mark as
Optimization.
* ipa-icf.c (gate, sem_item_optimizer::filter_removed_items):
Fix for IPA.
2015-01-18 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64378 PR ipa/64378
* ipa-prop.c (try_make_edge_direct_virtual_call): Clear speculative * ipa-prop.c (try_make_edge_direct_virtual_call): Clear speculative
flag correctly. flag correctly.
......
...@@ -912,11 +912,11 @@ Common Report Var(flag_asynchronous_unwind_tables) Optimization ...@@ -912,11 +912,11 @@ Common Report Var(flag_asynchronous_unwind_tables) Optimization
Generate unwind tables that are exact at each instruction boundary Generate unwind tables that are exact at each instruction boundary
fauto-inc-dec fauto-inc-dec
Common Report Var(flag_auto_inc_dec) Init(1) Common Report Var(flag_auto_inc_dec) Init(1) Optimization
Generate auto-inc/dec instructions Generate auto-inc/dec instructions
fauto-profile fauto-profile
Common Report Var(flag_auto_profile) Optimization Common Report Var(flag_auto_profile)
Use sample profile information for call graph node weights. The default Use sample profile information for call graph node weights. The default
profile file is fbdata.afdo in 'pwd'. profile file is fbdata.afdo in 'pwd'.
...@@ -981,7 +981,7 @@ Common Report Var(flag_combine_stack_adjustments) Optimization ...@@ -981,7 +981,7 @@ Common Report Var(flag_combine_stack_adjustments) Optimization
Looks for opportunities to reduce stack adjustments and stack references. Looks for opportunities to reduce stack adjustments and stack references.
fcommon fcommon
Common Report Var(flag_no_common,0) Optimization Common Report Var(flag_no_common,0)
Do not put uninitialized globals in the common section Do not put uninitialized globals in the common section
fcompare-debug fcompare-debug
...@@ -1029,7 +1029,7 @@ Common Report Var(flag_cx_fortran_rules) Optimization ...@@ -1029,7 +1029,7 @@ Common Report Var(flag_cx_fortran_rules) Optimization
Complex multiplication and division follow Fortran rules Complex multiplication and division follow Fortran rules
fdata-sections fdata-sections
Common Report Var(flag_data_sections) Optimization Common Report Var(flag_data_sections)
Place data items into their own section Place data items into their own section
fdbg-cnt-list fdbg-cnt-list
...@@ -1059,7 +1059,7 @@ Common Report Var(flag_delayed_branch) Optimization ...@@ -1059,7 +1059,7 @@ Common Report Var(flag_delayed_branch) Optimization
Attempt to fill delay slots of branch instructions Attempt to fill delay slots of branch instructions
fdelete-dead-exceptions fdelete-dead-exceptions
Common Report Var(flag_delete_dead_exceptions) Init(0) Common Report Var(flag_delete_dead_exceptions) Init(0) Optimization
Delete dead instructions that may throw exceptions Delete dead instructions that may throw exceptions
fdelete-null-pointer-checks fdelete-null-pointer-checks
...@@ -1268,7 +1268,7 @@ Enum(fp_contract_mode) String(fast) Value(FP_CONTRACT_FAST) ...@@ -1268,7 +1268,7 @@ Enum(fp_contract_mode) String(fast) Value(FP_CONTRACT_FAST)
; Used for compiling the Unix kernel, where strange substitutions are ; Used for compiling the Unix kernel, where strange substitutions are
; done on the assembly output. ; done on the assembly output.
ffunction-cse ffunction-cse
Common Report Var(flag_no_function_cse,0) Common Report Var(flag_no_function_cse,0) Optimization
Allow function addresses to be held in registers Allow function addresses to be held in registers
ffunction-sections ffunction-sections
...@@ -1299,7 +1299,7 @@ has finished ...@@ -1299,7 +1299,7 @@ has finished
; This option is not documented yet as its semantics will change. ; This option is not documented yet as its semantics will change.
fgraphite fgraphite
Common Report Var(flag_graphite) Common Report Var(flag_graphite) Opitmization
Enable in and out of Graphite representation Enable in and out of Graphite representation
fgraphite-identity fgraphite-identity
...@@ -1348,7 +1348,7 @@ Common Report Var(flag_loop_optimize_isl) Optimization ...@@ -1348,7 +1348,7 @@ Common Report Var(flag_loop_optimize_isl) Optimization
Enable the ISL based loop nest optimizer Enable the ISL based loop nest optimizer
fstrict-volatile-bitfields fstrict-volatile-bitfields
Common Report Var(flag_strict_volatile_bitfields) Init(-1) Common Report Var(flag_strict_volatile_bitfields) Init(-1) Optimization
Force bitfield accesses to match their type width Force bitfield accesses to match their type width
fguess-branch-probability fguess-branch-probability
...@@ -1477,7 +1477,7 @@ Common Report Var(flag_ipa_icf_functions) Optimization ...@@ -1477,7 +1477,7 @@ Common Report Var(flag_ipa_icf_functions) Optimization
Perform Identical Code Folding for functions Perform Identical Code Folding for functions
fipa-icf-variables fipa-icf-variables
Common Report Var(flag_ipa_icf_variables) Optimization Common Report Var(flag_ipa_icf_variables)
Perform Identical Code Folding for variables Perform Identical Code Folding for variables
fipa-reference fipa-reference
...@@ -1493,7 +1493,7 @@ Common Ignore ...@@ -1493,7 +1493,7 @@ Common Ignore
Does nothing. Preserved for backward compatibility. Does nothing. Preserved for backward compatibility.
fira-algorithm= fira-algorithm=
Common Joined RejectNegative Enum(ira_algorithm) Var(flag_ira_algorithm) Init(IRA_ALGORITHM_CB) Common Joined RejectNegative Enum(ira_algorithm) Var(flag_ira_algorithm) Init(IRA_ALGORITHM_CB) Optimization
-fira-algorithm=[CB|priority] Set the used IRA algorithm -fira-algorithm=[CB|priority] Set the used IRA algorithm
Enum Enum
...@@ -1506,7 +1506,7 @@ EnumValue ...@@ -1506,7 +1506,7 @@ EnumValue
Enum(ira_algorithm) String(priority) Value(IRA_ALGORITHM_PRIORITY) Enum(ira_algorithm) String(priority) Value(IRA_ALGORITHM_PRIORITY)
fira-region= fira-region=
Common Joined RejectNegative Enum(ira_region) Var(flag_ira_region) Init(IRA_REGION_AUTODETECT) Common Joined RejectNegative Enum(ira_region) Var(flag_ira_region) Init(IRA_REGION_AUTODETECT) Optimization
-fira-region=[one|all|mixed] Set regions for IRA -fira-region=[one|all|mixed] Set regions for IRA
Enum Enum
...@@ -1532,11 +1532,11 @@ Use IRA based register pressure calculation ...@@ -1532,11 +1532,11 @@ Use IRA based register pressure calculation
in RTL loop optimizations. in RTL loop optimizations.
fira-share-save-slots fira-share-save-slots
Common Report Var(flag_ira_share_save_slots) Init(1) Common Report Var(flag_ira_share_save_slots) Init(1) Optimization
Share slots for saving different hard registers. Share slots for saving different hard registers.
fira-share-spill-slots fira-share-spill-slots
Common Report Var(flag_ira_share_spill_slots) Init(1) Common Report Var(flag_ira_share_spill_slots) Init(1) Optimization
Share stack slots for spilled pseudo-registers. Share stack slots for spilled pseudo-registers.
fira-verbose= fira-verbose=
...@@ -1658,7 +1658,7 @@ Common Report Var(flag_modulo_sched) Optimization ...@@ -1658,7 +1658,7 @@ Common Report Var(flag_modulo_sched) Optimization
Perform SMS based modulo scheduling before the first scheduling pass Perform SMS based modulo scheduling before the first scheduling pass
fmodulo-sched-allow-regmoves fmodulo-sched-allow-regmoves
Common Report Var(flag_modulo_sched_allow_regmoves) Common Report Var(flag_modulo_sched_allow_regmoves) Optimization
Perform SMS based modulo scheduling with register moves allowed Perform SMS based modulo scheduling with register moves allowed
fmove-loop-invariants fmove-loop-invariants
...@@ -1719,7 +1719,7 @@ Common Report Var(flag_optimize_sibling_calls) Optimization ...@@ -1719,7 +1719,7 @@ Common Report Var(flag_optimize_sibling_calls) Optimization
Optimize sibling and tail recursive calls Optimize sibling and tail recursive calls
fpartial-inlining fpartial-inlining
Common Report Var(flag_partial_inlining) Common Report Var(flag_partial_inlining) Optimization
Perform partial inlining Perform partial inlining
fpre-ipa-mem-report fpre-ipa-mem-report
...@@ -1966,7 +1966,7 @@ Common Report Var(flag_sched_stalled_insns) Optimization UInteger ...@@ -1966,7 +1966,7 @@ Common Report Var(flag_sched_stalled_insns) Optimization UInteger
Allow premature scheduling of queued insns Allow premature scheduling of queued insns
fsched-stalled-insns= fsched-stalled-insns=
Common RejectNegative Joined UInteger Common RejectNegative Joined UInteger Optimization
-fsched-stalled-insns=<number> Set number of queued insns that can be prematurely scheduled -fsched-stalled-insns=<number> Set number of queued insns that can be prematurely scheduled
; sched_stalled_insns_dep controls how many recently scheduled cycles will ; sched_stalled_insns_dep controls how many recently scheduled cycles will
...@@ -1978,7 +1978,7 @@ Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimization UInteger ...@@ -1978,7 +1978,7 @@ Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimization UInteger
Set dependence distance checking in premature scheduling of queued insns Set dependence distance checking in premature scheduling of queued insns
fsched-stalled-insns-dep= fsched-stalled-insns-dep=
Common RejectNegative Joined UInteger Common RejectNegative Joined UInteger Optimization
-fsched-stalled-insns-dep=<number> Set dependence distance checking in premature scheduling of queued insns -fsched-stalled-insns-dep=<number> Set dependence distance checking in premature scheduling of queued insns
fsched-group-heuristic fsched-group-heuristic
...@@ -2114,7 +2114,7 @@ Common Report Var(flag_strict_aliasing) Optimization ...@@ -2114,7 +2114,7 @@ Common Report Var(flag_strict_aliasing) Optimization
Assume strict aliasing rules apply Assume strict aliasing rules apply
fstrict-overflow fstrict-overflow
Common Report Var(flag_strict_overflow) Common Report Var(flag_strict_overflow) Optimization
Treat signed overflow as undefined Treat signed overflow as undefined
fsync-libcalls fsync-libcalls
...@@ -2157,11 +2157,11 @@ EnumValue ...@@ -2157,11 +2157,11 @@ EnumValue
Enum(tls_model) String(local-exec) Value(TLS_MODEL_LOCAL_EXEC) Enum(tls_model) String(local-exec) Value(TLS_MODEL_LOCAL_EXEC)
ftoplevel-reorder ftoplevel-reorder
Common Report Var(flag_toplevel_reorder) Init(2) Optimization Common Report Var(flag_toplevel_reorder) Init(2)
Reorder top level functions, variables, and asms Reorder top level functions, variables, and asms
ftracer ftracer
Common Report Var(flag_tracer) Common Report Var(flag_tracer) Optimization
Perform superblock formation via tail duplication Perform superblock formation via tail duplication
; Zero means that floating-point math operations cannot generate a ; Zero means that floating-point math operations cannot generate a
...@@ -2285,7 +2285,7 @@ Common Report Var(flag_tree_loop_optimize) Init(1) Optimization ...@@ -2285,7 +2285,7 @@ Common Report Var(flag_tree_loop_optimize) Init(1) Optimization
Enable loop optimizations on tree level Enable loop optimizations on tree level
ftree-parallelize-loops= ftree-parallelize-loops=
Common Report Joined RejectNegative UInteger Var(flag_tree_parallelize_loops) Init(1) Common Report Joined RejectNegative UInteger Var(flag_tree_parallelize_loops) Init(1) Optimization
Enable automatic parallelization of loops Enable automatic parallelization of loops
ftree-phiprop ftree-phiprop
...@@ -2337,7 +2337,7 @@ Common Report Var(flag_tree_vrp) Init(0) Optimization ...@@ -2337,7 +2337,7 @@ Common Report Var(flag_tree_vrp) Init(0) Optimization
Perform Value Range Propagation on trees Perform Value Range Propagation on trees
funit-at-a-time funit-at-a-time
Common Report Var(flag_unit_at_a_time) Init(1) Optimization Common Report Var(flag_unit_at_a_time) Init(1)
Compile whole compilation unit at a time Compile whole compilation unit at a time
funroll-loops funroll-loops
...@@ -2356,12 +2356,12 @@ Common Report Var(flag_unsafe_loop_optimizations) Optimization ...@@ -2356,12 +2356,12 @@ Common Report Var(flag_unsafe_loop_optimizations) Optimization
Allow loop optimizations to assume that the loops behave in normal way Allow loop optimizations to assume that the loops behave in normal way
fassociative-math fassociative-math
Common Report Var(flag_associative_math) SetByCombined Common Report Var(flag_associative_math) SetByCombined Optimization
Allow optimization for floating-point arithmetic which may change the Allow optimization for floating-point arithmetic which may change the
result of the operation due to rounding. result of the operation due to rounding.
freciprocal-math freciprocal-math
Common Report Var(flag_reciprocal_math) SetByCombined Common Report Var(flag_reciprocal_math) SetByCombined Optimization
Same as -fassociative-math for expressions which include division. Same as -fassociative-math for expressions which include division.
; Nonzero means that unsafe floating-point math optimizations are allowed ; Nonzero means that unsafe floating-point math optimizations are allowed
...@@ -2439,11 +2439,11 @@ Common Report Var(flag_tree_slp_vectorize) Optimization ...@@ -2439,11 +2439,11 @@ Common Report Var(flag_tree_slp_vectorize) Optimization
Enable basic block vectorization (SLP) on trees Enable basic block vectorization (SLP) on trees
fvect-cost-model= fvect-cost-model=
Common Joined RejectNegative Enum(vect_cost_model) Var(flag_vect_cost_model) Init(VECT_COST_MODEL_DEFAULT) Common Joined RejectNegative Enum(vect_cost_model) Var(flag_vect_cost_model) Init(VECT_COST_MODEL_DEFAULT) Optimization
Specifies the cost model for vectorization Specifies the cost model for vectorization
fsimd-cost-model= fsimd-cost-model=
Common Joined RejectNegative Enum(vect_cost_model) Var(flag_simd_cost_model) Init(VECT_COST_MODEL_UNLIMITED) Common Joined RejectNegative Enum(vect_cost_model) Var(flag_simd_cost_model) Init(VECT_COST_MODEL_UNLIMITED) Optimization
Specifies the vectorization cost model for code marked with a simd directive Specifies the vectorization cost model for code marked with a simd directive
Enum Enum
...@@ -2540,7 +2540,7 @@ Common Report Var(flag_tree_builtin_call_dce) Init(0) Optimization ...@@ -2540,7 +2540,7 @@ Common Report Var(flag_tree_builtin_call_dce) Init(0) Optimization
Enable conditional dead code elimination for builtin calls Enable conditional dead code elimination for builtin calls
fwhole-program fwhole-program
Common Report Var(flag_whole_program) Init(0) Optimization Common Report Var(flag_whole_program) Init(0)
Perform whole program optimizations Perform whole program optimizations
fwrapv fwrapv
......
...@@ -1652,7 +1652,8 @@ sem_item_optimizer::filter_removed_items (void) ...@@ -1652,7 +1652,8 @@ sem_item_optimizer::filter_removed_items (void)
{ {
sem_item *item = m_items[i]; sem_item *item = m_items[i];
if (!flag_ipa_icf_functions && item->type == FUNC) if (item->type == FUNC
&& !opt_for_fn (item->decl, flag_ipa_icf_functions))
{ {
remove_item (item); remove_item (item);
continue; continue;
...@@ -2499,7 +2500,7 @@ public: ...@@ -2499,7 +2500,7 @@ public:
/* opt_pass methods: */ /* opt_pass methods: */
virtual bool gate (function *) virtual bool gate (function *)
{ {
return flag_ipa_icf_variables || flag_ipa_icf_functions; return in_lto_p || flag_ipa_icf_variables || flag_ipa_icf_functions;
} }
virtual unsigned int execute (function *) virtual unsigned int execute (function *)
......
...@@ -132,6 +132,9 @@ static splay_tree reference_vars_to_consider; ...@@ -132,6 +132,9 @@ static splay_tree reference_vars_to_consider;
static we are considering. This is added to the local info when asm static we are considering. This is added to the local info when asm
code is found that clobbers all memory. */ code is found that clobbers all memory. */
static bitmap all_module_statics; static bitmap all_module_statics;
/* Set of all statics that should be ignored becuase they are touched by
-fno-ipa-reference code. */
static bitmap ignore_module_statics;
/* Obstack holding bitmaps of local analysis (live from analysis to /* Obstack holding bitmaps of local analysis (live from analysis to
propagation) */ propagation) */
...@@ -198,6 +201,9 @@ set_reference_optimization_summary (struct cgraph_node *node, ...@@ -198,6 +201,9 @@ set_reference_optimization_summary (struct cgraph_node *node,
bitmap bitmap
ipa_reference_get_not_read_global (struct cgraph_node *fn) ipa_reference_get_not_read_global (struct cgraph_node *fn)
{ {
if (!opt_for_fn (fn->decl, flag_ipa_reference)
|| !opt_for_fn (current_function_decl, flag_ipa_reference))
return NULL;
ipa_reference_optimization_summary_t info = ipa_reference_optimization_summary_t info =
get_reference_optimization_summary (fn->function_symbol (NULL)); get_reference_optimization_summary (fn->function_symbol (NULL));
if (info) if (info)
...@@ -216,6 +222,9 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn) ...@@ -216,6 +222,9 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn)
bitmap bitmap
ipa_reference_get_not_written_global (struct cgraph_node *fn) ipa_reference_get_not_written_global (struct cgraph_node *fn)
{ {
if (!opt_for_fn (fn->decl, flag_ipa_reference)
|| !opt_for_fn (current_function_decl, flag_ipa_reference))
return NULL;
ipa_reference_optimization_summary_t info = ipa_reference_optimization_summary_t info =
get_reference_optimization_summary (fn); get_reference_optimization_summary (fn);
if (info) if (info)
...@@ -273,6 +282,8 @@ is_proper_for_analysis (tree t) ...@@ -273,6 +282,8 @@ is_proper_for_analysis (tree t)
return false; return false;
/* TODO: Check aliases. */ /* TODO: Check aliases. */
if (bitmap_bit_p (ignore_module_statics, DECL_UID (t)))
return false;
/* This is a variable we care about. Check if we have seen it /* This is a variable we care about. Check if we have seen it
before, and if not add it the set of variables we care about. */ before, and if not add it the set of variables we care about. */
...@@ -381,8 +392,9 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x ...@@ -381,8 +392,9 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x
/* Only look into nodes we can propagate something. */ /* Only look into nodes we can propagate something. */
int flags = flags_from_decl_or_type (y->decl); int flags = flags_from_decl_or_type (y->decl);
if (avail > AVAIL_INTERPOSABLE if (opt_for_fn (y->decl, flag_ipa_reference)
|| (avail == AVAIL_INTERPOSABLE && (flags & ECF_LEAF))) && (avail > AVAIL_INTERPOSABLE
|| (avail == AVAIL_INTERPOSABLE && (flags & ECF_LEAF))))
{ {
if (get_reference_vars_info (y)) if (get_reference_vars_info (y))
{ {
...@@ -437,6 +449,7 @@ ipa_init (void) ...@@ -437,6 +449,7 @@ ipa_init (void)
bitmap_obstack_initialize (&local_info_obstack); bitmap_obstack_initialize (&local_info_obstack);
bitmap_obstack_initialize (&optimization_summary_obstack); bitmap_obstack_initialize (&optimization_summary_obstack);
all_module_statics = BITMAP_ALLOC (&optimization_summary_obstack); all_module_statics = BITMAP_ALLOC (&optimization_summary_obstack);
ignore_module_statics = BITMAP_ALLOC (&optimization_summary_obstack);
node_removal_hook_holder = node_removal_hook_holder =
symtab->add_cgraph_removal_hook (&remove_node_data, NULL); symtab->add_cgraph_removal_hook (&remove_node_data, NULL);
...@@ -474,6 +487,8 @@ analyze_function (struct cgraph_node *fn) ...@@ -474,6 +487,8 @@ analyze_function (struct cgraph_node *fn)
int i; int i;
tree var; tree var;
if (!opt_for_fn (fn->decl, flag_ipa_reference))
return;
local = init_function_info (fn); local = init_function_info (fn);
for (i = 0; fn->iterate_reference (i, ref); i++) for (i = 0; fn->iterate_reference (i, ref); i++)
{ {
...@@ -559,6 +574,22 @@ generate_summary (void) ...@@ -559,6 +574,22 @@ generate_summary (void)
/* Process all of the functions next. */ /* Process all of the functions next. */
FOR_EACH_DEFINED_FUNCTION (node) FOR_EACH_DEFINED_FUNCTION (node)
if (!node->alias && !opt_for_fn (node->decl, flag_ipa_reference))
{
struct ipa_ref *ref = NULL;
int i;
tree var;
for (i = 0; node->iterate_reference (i, ref); i++)
{
if (!is_a <varpool_node *> (ref->referred))
continue;
var = ref->referred->decl;
if (!is_proper_for_analysis (var))
continue;
bitmap_set_bit (ignore_module_statics, DECL_UID (var));
}
}
FOR_EACH_DEFINED_FUNCTION (node)
analyze_function (node); analyze_function (node);
if (dump_file) if (dump_file)
...@@ -570,7 +601,8 @@ generate_summary (void) ...@@ -570,7 +601,8 @@ generate_summary (void)
if (dump_file) if (dump_file)
FOR_EACH_DEFINED_FUNCTION (node) FOR_EACH_DEFINED_FUNCTION (node)
if (node->get_availability () >= AVAIL_INTERPOSABLE) if (node->get_availability () >= AVAIL_INTERPOSABLE
&& opt_for_fn (node->decl, flag_ipa_reference))
{ {
ipa_reference_local_vars_info_t l; ipa_reference_local_vars_info_t l;
unsigned int index; unsigned int index;
...@@ -607,7 +639,7 @@ read_write_all_from_decl (struct cgraph_node *node, ...@@ -607,7 +639,7 @@ read_write_all_from_decl (struct cgraph_node *node,
tree decl = node->decl; tree decl = node->decl;
int flags = flags_from_decl_or_type (decl); int flags = flags_from_decl_or_type (decl);
if ((flags & ECF_LEAF) if ((flags & ECF_LEAF)
&& node->get_availability () <= AVAIL_INTERPOSABLE) && node->get_availability () < AVAIL_INTERPOSABLE)
; ;
else if (flags & ECF_CONST) else if (flags & ECF_CONST)
; ;
...@@ -640,7 +672,8 @@ get_read_write_all_from_node (struct cgraph_node *node, ...@@ -640,7 +672,8 @@ get_read_write_all_from_node (struct cgraph_node *node,
struct cgraph_edge *e, *ie; struct cgraph_edge *e, *ie;
/* When function is overwritable, we can not assume anything. */ /* When function is overwritable, we can not assume anything. */
if (node->get_availability () <= AVAIL_INTERPOSABLE) if (node->get_availability () <= AVAIL_INTERPOSABLE
|| (node->analyzed && !opt_for_fn (node->decl, flag_ipa_reference)))
read_write_all_from_decl (node, read_all, write_all); read_write_all_from_decl (node, read_all, write_all);
for (e = node->callees; for (e = node->callees;
...@@ -650,7 +683,8 @@ get_read_write_all_from_node (struct cgraph_node *node, ...@@ -650,7 +683,8 @@ get_read_write_all_from_node (struct cgraph_node *node,
enum availability avail; enum availability avail;
struct cgraph_node *callee = e->callee->function_symbol (&avail); struct cgraph_node *callee = e->callee->function_symbol (&avail);
gcc_checking_assert (callee); gcc_checking_assert (callee);
if (avail <= AVAIL_INTERPOSABLE) if (avail <= AVAIL_INTERPOSABLE
|| (callee->analyzed && !opt_for_fn (callee->decl, flag_ipa_reference)))
read_write_all_from_decl (callee, read_all, write_all); read_write_all_from_decl (callee, read_all, write_all);
} }
...@@ -672,6 +706,18 @@ get_read_write_all_from_node (struct cgraph_node *node, ...@@ -672,6 +706,18 @@ get_read_write_all_from_node (struct cgraph_node *node,
} }
} }
/* Skip edges from and to nodes without ipa_reference enables. This leave
them out of strongy connected coponents and makes them easyto skip in the
propagation loop bellow. */
static bool
ignore_edge_p (cgraph_edge *e)
{
return (!opt_for_fn (e->caller->decl, flag_ipa_reference)
|| !opt_for_fn (e->callee->function_symbol ()->decl,
flag_ipa_reference));
}
/* Produce the global information by preforming a transitive closure /* Produce the global information by preforming a transitive closure
on the local information that was produced by ipa_analyze_function. */ on the local information that was produced by ipa_analyze_function. */
...@@ -695,7 +741,7 @@ propagate (void) ...@@ -695,7 +741,7 @@ propagate (void)
the global information. All the nodes within a cycle will have the global information. All the nodes within a cycle will have
the same info so we collapse cycles first. Then we can do the the same info so we collapse cycles first. Then we can do the
propagation in one pass from the leaves to the roots. */ propagation in one pass from the leaves to the roots. */
order_pos = ipa_reduced_postorder (order, true, true, NULL); order_pos = ipa_reduced_postorder (order, true, true, ignore_edge_p);
if (dump_file) if (dump_file)
ipa_print_order (dump_file, "reduced", order, order_pos); ipa_print_order (dump_file, "reduced", order, order_pos);
...@@ -710,7 +756,7 @@ propagate (void) ...@@ -710,7 +756,7 @@ propagate (void)
bool write_all = false; bool write_all = false;
node = order[i]; node = order[i];
if (node->alias) if (node->alias || !opt_for_fn (node->decl, flag_ipa_reference))
continue; continue;
node_info = get_reference_vars_info (node); node_info = get_reference_vars_info (node);
...@@ -788,7 +834,7 @@ propagate (void) ...@@ -788,7 +834,7 @@ propagate (void)
struct cgraph_node *w; struct cgraph_node *w;
node = order[i]; node = order[i];
if (node->alias) if (node->alias || !opt_for_fn (node->decl, flag_ipa_reference))
continue; continue;
fprintf (dump_file, fprintf (dump_file,
...@@ -829,7 +875,7 @@ propagate (void) ...@@ -829,7 +875,7 @@ propagate (void)
ipa_reference_optimization_summary_t opt; ipa_reference_optimization_summary_t opt;
node_info = get_reference_vars_info (node); node_info = get_reference_vars_info (node);
if (!node->alias if (!node->alias && opt_for_fn (node->decl, flag_ipa_reference)
&& (node->get_availability () > AVAIL_INTERPOSABLE && (node->get_availability () > AVAIL_INTERPOSABLE
|| (flags_from_decl_or_type (node->decl) & ECF_LEAF))) || (flags_from_decl_or_type (node->decl) & ECF_LEAF)))
{ {
...@@ -1178,7 +1224,7 @@ public: ...@@ -1178,7 +1224,7 @@ public:
/* opt_pass methods: */ /* opt_pass methods: */
virtual bool gate (function *) virtual bool gate (function *)
{ {
return (flag_ipa_reference return ((in_lto_p || flag_ipa_reference)
/* Don't bother doing anything if the program has errors. */ /* Don't bother doing anything if the program has errors. */
&& !seen_error ()); && !seen_error ());
} }
......
...@@ -84,15 +84,17 @@ print "void"; ...@@ -84,15 +84,17 @@ print "void";
print "cl_optimization_save (struct cl_optimization *ptr, struct gcc_options *opts)"; print "cl_optimization_save (struct cl_optimization *ptr, struct gcc_options *opts)";
print "{"; print "{";
n_opt_char = 2; n_opt_char = 3;
n_opt_short = 0; n_opt_short = 0;
n_opt_int = 0; n_opt_int = 0;
n_opt_enum = 1; n_opt_enum = 1;
n_opt_other = 0; n_opt_other = 0;
var_opt_char[0] = "optimize"; var_opt_char[0] = "optimize";
var_opt_char[1] = "optimize_size"; var_opt_char[1] = "optimize_size";
var_opt_char[2] = "optimize_debug";
var_opt_range["optimize"] = "0, 255"; var_opt_range["optimize"] = "0, 255";
var_opt_range["optimize_size"] = "0, 255"; var_opt_range["optimize_size"] = "0, 1";
var_opt_range["optimize_debug"] = "0, 1";
var_opt_enum[0] = "flag_fp_contract_mode"; var_opt_enum[0] = "flag_fp_contract_mode";
# Sort by size to mimic how the structure is laid out to be friendlier to the # Sort by size to mimic how the structure is laid out to be friendlier to the
...@@ -734,11 +736,13 @@ for (i = 0; i < n_target_val; i++) { ...@@ -734,11 +736,13 @@ for (i = 0; i < n_target_val; i++) {
print "}"; print "}";
n_opt_val = 2; n_opt_val = 3;
var_opt_val[0] = "x_optimize" var_opt_val[0] = "x_optimize"
var_opt_val_type[0] = "char " var_opt_val_type[0] = "char "
var_opt_val[1] = "x_optimize_size" var_opt_val[1] = "x_optimize_size"
var_opt_val[2] = "x_optimize_debug"
var_opt_val_type[1] = "char " var_opt_val_type[1] = "char "
var_opt_val_type[2] = "char "
for (i = 0; i < n_opts; i++) { for (i = 0; i < n_opts; i++) {
if (flag_set_p("Optimization", flags[i])) { if (flag_set_p("Optimization", flags[i])) {
name = var_name(flags[i]) name = var_name(flags[i])
......
...@@ -132,13 +132,14 @@ print "/* Structure to save/restore optimization and target specific options. * ...@@ -132,13 +132,14 @@ print "/* Structure to save/restore optimization and target specific options. *
print "struct GTY(()) cl_optimization"; print "struct GTY(()) cl_optimization";
print "{"; print "{";
n_opt_char = 2; n_opt_char = 3;
n_opt_short = 0; n_opt_short = 0;
n_opt_int = 0; n_opt_int = 0;
n_opt_enum = 1; n_opt_enum = 1;
n_opt_other = 0; n_opt_other = 0;
var_opt_char[0] = "unsigned char x_optimize"; var_opt_char[0] = "unsigned char x_optimize";
var_opt_char[1] = "unsigned char x_optimize_size"; var_opt_char[1] = "unsigned char x_optimize_size";
var_opt_char[2] = "unsigned char x_optimize_debug";
var_opt_enum[0] = "enum fp_contract_mode x_flag_fp_contract_mode"; var_opt_enum[0] = "enum fp_contract_mode x_flag_fp_contract_mode";
for (i = 0; i < n_opts; i++) { for (i = 0; i < n_opts; i++) {
......
2015-01-18 Jan Hubicka <hubicka@ucw.cz> 2015-01-18 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/ipa/ipa-icf-32.c: Update template.
* c-c++-common/asan/instrument-with-calls-3.c: Likewise.
* c-c++-common/asan/instrument-with-calls-2.c: Likewise.
* c-c++-common/asan/instrument-with-calls-1.c: Likewise.
* c-c++-common/asan/kasan-recover-1.c: Likewise.
* c-c++-common/asan/kasan-recover-2.c: Likewise.
2015-01-18 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64378 PR ipa/64378
* g++.dg/torture/pr64378.C: New testcase. * g++.dg/torture/pr64378.C: New testcase.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "--param asan-instrumentation-with-call-threshold=0" } */ /* { dg-options "--param asan-instrumentation-with-call-threshold=0 -ffat-lto-objects" } */
void f(char *a, int *b) { void f(char *a, int *b) {
*b = *a; *b = *a;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "--param asan-instrumentation-with-call-threshold=1" } */ /* { dg-options "--param asan-instrumentation-with-call-threshold=1 -ffat-lto-objects" } */
int x; int x;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "--param asan-instrumentation-with-call-threshold=0" } */ /* { dg-options "--param asan-instrumentation-with-call-threshold=0 -ffat-lto-objects" } */
struct A { struct A {
char x[7]; char x[7];
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=100" } */ /* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=100 -ffat-lto-objects" } */
void void
foo (int *p) foo (int *p)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address" } */ /* { dg-options "-fno-sanitize=address -fsanitize=kernel-address -ffat-lto-objects" } */
void void
foo (int *p) foo (int *p)
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O0 -fipa-icf -fdump-ipa-icf-details" } */ /* { dg-options "-O1 -fipa-icf -fdump-ipa-icf-details" } */
int int
__attribute__((optimize("O0"), noinline, noclone)) __attribute__((optimize("Os"), noinline, noclone))
foo(int a) foo(int a)
{ {
return a * a; return a * a;
......
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