Commit Graph

218 Commits

Author SHA1 Message Date
Martin Jambor 29be383567 re PR tree-optimization/43905 (duplicate __PRETTY_FUNCTION__ symbol for functions differing in const-ness)
2010-06-16  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43905
	* tree-sra.c: Include tree-inline.h.
	(create_abstract_origin): Removed.
	(modify_function): Version the call graph node instead of creating
	abstract origins and dealing with same_body aliases.
	* tree-sra.c (ipa_sra_preliminary_function_checks): Check whether the
	function is versionable.
	* Makefile.in (tree-sra.o): Add TREE_INLINE_H to dependencies.

	* testsuite/g++.dg/torture/pr43905.C: New test.

From-SVN: r160832
2010-06-16 14:21:56 +02:00
Martin Jambor eed5f58ad6 re PR lto/44464 (ICE during linux kernel whopr build)
2010-06-15  Martin Jambor  <mjambor@suse.cz>

	PR lto/44464
	* tree-sra.c (replace_removed_params_ssa_names): Call release_ssa_name
	on the newly dead SSA name.

From-SVN: r160777
2010-06-15 13:09:12 +02:00
Martin Jambor 567a4beb36 Makefile.in (tree-sra.o): Add DBGCNT_H to dependencies.
2010-06-10  Martin Jambor  <mjambor@suse.cz>

	* Makefile.in (tree-sra.o): Add DBGCNT_H to dependencies.
	* dbgcnt.def (tree_sra): New counter.
	* tree-sra.c: Include dbgcnt.h.
	(gate_intra_sra): Check tree_sra debug counter.

From-SVN: r160562
2010-06-10 18:51:20 +02:00
Martin Jambor 591d4f4a63 re PR tree-optimization/44258 (possible SRA wrong-code generation.)
2010-06-10  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/44258
	* tree-sra.c (build_access_subtree): Return false iff there is a
	partial overlap.
	(build_access_trees): Likewise.
	(analyze_all_variable_accesses): Disqualify candidates if
	build_access_trees returns true for them.

	* testsuite/gcc.dg/tree-ssa/pr44258.c: New test.

From-SVN: r160561
2010-06-10 18:49:09 +02:00
Martin Jambor 1536b6ab54 re PR tree-optimization/44423 (Massive performance regression in SSE code due to SRA)
2010-06-09  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/44423
	* tree-sra.c (dump_access): Dump also grp_assignment_read.
	(analyze_access_subtree): Pass negative allow_replacements to children
	if the current type is scalar.

	* testsuite/gcc.dg/tree-ssa/pr44423.c: New test.

From-SVN: r160462
2010-06-09 13:20:03 +02:00
Steven Bosscher 2eb79bbbb3 gimplify.c: Do not include except.h and optabs.h.
* gimplify.c: Do not include except.h and optabs.h.
	(gimplify_body): Do not initialize RTL profiling.
	* gimple-low.c: Do not include rtl.h, diagnostic.h, langhooks.h,
	langhooks-def.h, timevar.h, except.h, hashtab.h, and expr.h.
	* gimple-fold.c: Do not include rtl.h, tm_p.h, ggc.h, basic-block.h,
	output.h, expr.h, diagnostic.h, timevar.h, value-prof.h, and
	langhooks.h.

	* tree-pretty-print.h: Include pretty-print.h.
	* gimple-pretty-print.h: Include pretty-print.h.

	* tree-pretty-print.c: Do not include diagnostic.h.
	* tree-vrp.c: Likewise.
	* tree-tailcall.c: Likewise
	* tree-scalar-evolution.c: Likewise
	* tree-ssa-dse.c: Likewise
	* tree-chrec.c: Likewise
	* tree-ssa-sccvn.c: Likewise
	* tree-ssa-copyrename.c: Likewise
	* tree-nomudflap.c: Likewise
	* tree-call-cdce.c: Likewise
	* tree-stdarg.c: Likewise
	* tree-ssa-math-opts.c: Likewise
	* tree-nrv.c: Likewise
	* tree-ssa-sink.c: Likewise
	* tree-browser.c: Likewise
	* tree-ssa-loop-ivcanon.c: Likewise
	* tree-ssa-loop.c: Likewise
	* tree-parloops.c: Likewise
	* tree-ssa-address.c: Likewise
	* tree-ssa-ifcombine.c: Likewise
	* tree-if-conv.c: Likewise
	* tree-data-ref.c: Likewise
	* tree-affine.c: Likewise
	* tree-ssa-phiopt.c: Likewise
	* tree-ssa-coalesce.c: Likewise
	* tree-ssa-pre.c: Likewise
	* tree-ssa-live.c: Likewise
	* tree-predcom.c: Likewise
	* tree-ssa-forwprop.c: Likewise
	* tree-ssa-dce.c: Likewise
	* tree-ssa-ter.c: Likewise
	* tree-ssa-loop-prefetch.c: Likewise
	* tree-optimize.c: Likewise
	* tree-ssa-phiprop.c: Likewise
	* tree-object-size.c: Likewise
	* tree-outof-ssa.c: Likewise
	* tree-ssa-structalias.c: Likewise
	* tree-switch-conversion.c: Likewise
	* tree-ssa-reassoc.c: Likewise
	* tree-ssa-operands.c: Likewise
	* tree-vectorizer.c: Likewise
	* tree-vect-data-refs.c: Likewise
	* tree-vect-generic.c: Likewise
	* tree-vect-stmts.c: Likewise
	* tree-vect-patterns.c: Likewise
	* tree-vect-slp.c: Likewise
	* tree-vect-loop.c: Likewise
	* tree-ssa-loop-ivopts.c: Likewise
	* tree-ssa-loop-im.c: Likewise
	* tree-ssa-loop-niter.c: Likewise
	* tree-ssa-loop-unswitch.c: Likewise
	* tree-ssa-loop-manip.c: Likewise
	* tree-ssa-loop-ch.c: Likewise
	* tree-dump.c: Likewise
	* tree-complex.c: Likewise

	* tree-into-ssa.c: Do not include diagnostic.h and expr.h.
	* tree-ssa-uninit.c: Likewise
	* tree-ssa-threadupdate.c: Likewise
	* tree-ssa-uncprop.c: Likewise
	* tree-ssa-ccp.c: Likewise
	* tree-ssa-dom.c: Likewise
	* tree-ssa-propagate.c: Likewise
	* tree-ssa-alias.c: Likewise
	* tree-dfa.c: Likewise
	* tree-cfgcleanup.c: Likewise
	* tree-sra.c: Likewise
	* tree-ssa-copy.c: Likewise
	* tree-ssa.c: Likewise
	* tree-profile.c: Likewise
	* tree-cfg.c: Likewise
	* tree-ssa-threadedge.c: Likewise
	* tree-vect-loop-manip.c: Likewise

	* tree-inline.c: Do not include diagnostic.h and expr.h.
	Include rtl.h.
	(copy_decl_for_dup_finish): Do not use NULL_RTX.

	* tree-loop-linear.c: Do not include diagnostic.h, expr.h,
	and optabs.h.
	* tree-loop-distribution.c: Likewise.

From-SVN: r160125
2010-06-01 22:00:56 +00:00
Joseph Myers cf8358387d diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h.
* diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or
	langhooks-def.h.
	(diagnostic_initialize): Initialize x_data not last_function.
	(diagnostic_report_current_function): Move to tree-diagnostic.c.
	(default_diagnostic_starter): Call
	diagnostic_report_current_module not
	diagnostic_report_current_function.
	(diagnostic_report_diagnostic): Initialize x_data not
	abstract_origin.
	(verbatim): Likewise.
	* diagnostic.h (struct diagnostic_info): Change abstract_origin to
	x_data.
	(struct diagnostic_context): Change last_function to x_data.
	(diagnostic_auxiliary_data): Replace with
	diagnostic_context_auxiliary_data and
	diagnostic_info_auxiliary_data.
	(diagnostic_last_function_changed, diagnostic_set_last_function,
	diagnostic_report_current_function): Move to tree-diagnostic.h.
	(print_declaration, dump_generic_node, print_generic_stmt,
	print_generic_stmt_indented, print_generic_expr,
	print_generic_decl, debug_c_tree, dump_omp_clauses,
	print_call_name, debug_generic_expr, debug_generic_stmt,
	debug_tree_chain, default_tree_printer): Move to
	tree-pretty-print.h.
	(debug_gimple_stmt, debug_gimple_seq, print_gimple_seq,
	print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to
	gimple-pretty-print.h.
	* pretty-print.c: Don't include tree.h
	(pp_base_format): Don't handle %K here.
	(pp_base_tree_identifier): Move to tree-pretty-print.c.
	* pretty-print.h (text_info): Change abstract_origin to x_data.
	(pp_tree_identifier, pp_unsupported_tree,
	pp_base_tree_identifier): Move to tree-pretty-print.h.
	* gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h,
	tree-pretty-print.h: New files.
	* tree-pretty-print.c: Include tree-pretty-print.h.
	(percent_K_format): New.  Moved from pretty-print.c.
	(pp_base_tree_identifier): Move from pretty-print.c.
	* c-objc-common.c: Include tree-pretty-print.h.
	(c_tree_printer): Handle %K here.
	* langhooks.c: Include tree-diagnostic.h.
	(lhd_print_error_function): Use diagnostic_abstract_origin macro.
	* toplev.c: Include tree-diagnostic.h and tree-pretty-print.h.
	(default_tree_printer): Handle %K using percent_K_format.
	(general_init): Use default_tree_diagnostic_starter.
	* tree.c: Include tree-diagnostic.h and tree-pretty-print.h.
	(free_lang_data): Use default_tree_diagnostic_starter.
	* c-pretty-print.c: Include tree-pretty-print.h.
	* cfgexpand.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* cgraphunit.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* dwarf2out.c: Include tree-pretty-print.h.
	* except.c: Include tree-pretty-print.h.
	* gimple-pretty-print.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* gimplify.c: Include tree-pretty-print.h.
	* graphite-poly.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* ipa-cp.c: Include tree-pretty-print.h.
	* ipa-inline.c: Include gimple-pretty-print.h.
	* ipa-prop.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* ipa-pure-const.c: Include gimple-pretty-print.h.
	* ipa-struct-reorg.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* ipa-type-escape.c: Include tree-pretty-print.h.
	* print-rtl.c: Include tree-pretty-print.h.
	* print-tree.c: Include gimple-pretty-print.h.
	* sese.c: Include tree-pretty-print.h.
	* tree-affine.c: Include tree-pretty-print.h.
	* tree-browser.c: Include tree-pretty-print.h.
	* tree-call-cdce.c: Include gimple-pretty-print.h.
	* tree-cfg.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-chrec.c: Include tree-pretty-print.h.
	* tree-data-ref.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-dfa.c: Include tree-pretty-print.h.
	* tree-if-conv.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-inline.c: Include tree-pretty-print.h.
	* tree-into-ssa.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-nrv.c: Include tree-pretty-print.h.
	* tree-object-size.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-outof-ssa.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-parloops.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-predcom.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-scalar-evolution.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-sra.c: Include tree-pretty-print.h.
	* tree-ssa-address.c: Include tree-pretty-print.h.
	* tree-ssa-alias.c: Include tree-pretty-print.h.
	* tree-ssa-ccp.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-coalesce.c: Include tree-pretty-print.h.
	* tree-ssa-copy.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-copyrename.c: Include tree-pretty-print.h.
	* tree-ssa-dce.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-dom.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-dse.c: Include gimple-pretty-print.h.
	* tree-ssa-forwprop.c: Include tree-pretty-print.h.
	* tree-ssa-ifcombine.c: Include tree-pretty-print.h.
	* tree-ssa-live.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-loop-im.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-loop-niter.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-loop-prefetch.c: Include tree-pretty-print.h.
	* tree-ssa-math-opts.c: Include gimple-pretty-print.h.
	* tree-ssa-operands.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-phiprop.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-pre.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-propagate.c: Include gimple-pretty-print.h.
	* tree-ssa-reassoc.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-sccvn.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-sink.c: Include gimple-pretty-print.h.
	* tree-ssa-ter.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-ssa-uninit.c: Include gimple-pretty-print.h.
	* tree-ssa.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-stdarg.c: Include gimple-pretty-print.h.
	* tree-switch-conversion.c: Include gimple-pretty-print.h.
	* tree-tailcall.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vect-data-refs.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vect-loop-manip.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vect-loop.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vect-patterns.c: Include gimple-pretty-print.h.
	* tree-vect-slp.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vect-stmts.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* tree-vectorizer.c: Include tree-pretty-print.h.
	* tree-vrp.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* value-prof.c: Include tree-pretty-print.h and
	gimple-pretty-print.h.
	* var-tracking.c: Include tree-pretty-print.h.
	* Makefile.in (OBJS-common): Add tree-diagnostic.o.
	(tree-diagnostic.o): New dependencies.
	(c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o,
	tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o,
	tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o,
	tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o,
	tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o,
	tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o,
	tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o,
	tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o,
	tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o,
	tree-ssa-address.o, tree-ssa-loop-niter.o,
	tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o,
	tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o,
	tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o,
	gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o,
	tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o,
	tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o,
	tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o,
	tree-parloops.o, tree-stdarg.o, tree-object-size.o,
	gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o,
	toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o,
	ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o,
	ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o,
	tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o,
	tree-switch-conversion.o, var-tracking.o, value-prof.o,
	cfgexpand.o, pretty-print.o): Update dependencies.

cp:
	* error.c: Include tree-diagnostic.h and tree-pretty-print.h.
	(cp_print_error_function): Use diagnostic_abstract_origin macro.
	(cp_printer): Handle %K here using percent_K_format.
	* cxx-pretty-print.c: Include tree-pretty-print.h.
	* Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update
	dependencies.

From-SVN: r159685
2010-05-21 23:34:26 +01:00
Martin Jambor 5feb49f0a6 re PR middle-end/44133 (Uninit warning regression with new SRA)
2010-05-17  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/44133
	* tree-sra.c (create_access_replacement): New parameter rename, mark
	the replaement for renaming only when it is true.
	(get_access_replacement): Pass true in the rename parameter of
	create_access_replacement.
	(get_unrenamed_access_replacement): New function.
	(replace_uses_with_default_def_ssa_name): New parameter racc, get the
	replacement declaration from it.

	* testsuite/gcc.dg/tree-ssa/pr44133.c: New test.
	* testsuite/gcc.dg/tree-ssa/sra-9.c: Make the scan regular
	expression more precise.

From-SVN: r159482
2010-05-17 14:48:34 +02:00
Jakub Jelinek 823e947359 re PR debug/43983 (var-tracking needlessly throws away location info for SRAed vars)
PR debug/43983
	* var-tracking.c (track_expr_p): Allow tracking of variables optimized
	by SRA.
	* Makefile.in (dwarf2out.o): Depend on $(TREE_FLOW_H).
	* tree-sra.c (create_access_replacement): Call unshare_expr before
	passing expr to SET_DECL_DEBUG_EXPR, and remove any SSA_NAMEs from
	it.
	* dwarf2out.c: Include tree-flow.h.
	(struct var_loc_node): Rename var_loc_note field to loc, add comment.
	(size_of_loc_descr, output_loc_operands, output_loc_operands_raw):
	Handle DW_OP_bit_piece.
	(decl_piece_bitsize, decl_piece_varloc_ptr, decl_piece_node,
	construct_piece_list, adjust_piece_list): New functions.
	(add_var_loc_to_decl): Handle SRA optimized variables.
	Adjust for var_loc_note to loc field renaming.
	(dw_loc_list_1): For WANT_ADDRESS == 2 prefer DECL_MODE of decl
	in VAR_LOCATION note.
	(new_loc_descr_op_bit_piece): New function.
	(dw_sra_loc_expr): New function.
	(dw_loc_list): Use it.  Don't handle the last range after the
	loop, handle it inside of the loop.  Adjust for var_loc_note
	to loc field renaming.
	(add_location_or_const_value_attribute): Only special case
	single entry loc lists if loc is NOTE_P.  Adjust for
	var_loc_note to loc field renaming.
	(dwarf2out_var_location): Don't set newloc->var_loc_note
	and newloc->next here.

	* gcc.dg/guality/sra-1.c: New test.

From-SVN: r159357
2010-05-13 12:40:51 +02:00
Martin Jambor 6cbd3b6a69 tree-sra.c (build_access_from_expr_1): The first parameter type changed to simple tree.
2010-05-04  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (build_access_from_expr_1): The first parameter type
	changed to simple tree.
	(build_access_from_expr): Likewise, gsi parameter was eliminated.
	(scan_assign_result): Renamed to assignment_mod_result, enum elements
	renamed as well.
	(build_accesses_from_assign): Removed all parameters except for a
	simple gimple statement.  Now returns a simple bool.
	(scan_function): All non-analysis parts moved to separate functions
	sra_modify_function_body and ipa_sra_modify_function_body.  Removed all
	parameters and updated both callers.
	(sra_modify_expr): Removed parameter data.
	(sra_modify_function_body): New function.
	(perform_intra_sra): Call sra_modify_function_body to modify the
	function body.
	(replace_removed_params_ssa_names): Parameter data changed into
	adjustments vector.
	(sra_ipa_modify_expr): Likewise.  Also removed unused parameter gsi and
	changed the parameter dont_convert to convert with the opposite
	meaning.
	(sra_ipa_modify_assign): Parameter data changed into adjustments
	vector, return value changed to bool.
	(ipa_sra_modify_function_body): New function.
	(sra_ipa_reset_debug_stmts): Updated a comment.
	(modify_function): Use ipa_sra_modify_function_body to modify function
	body.

From-SVN: r159038
2010-05-04 19:34:01 +02:00
Martin Jambor 7762001162 re PR tree-optimization/43846 (array vs members, total scalarization issues)
2010-04-23  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43846
	* tree-sra.c (struct access): New flag grp_assignment_read.
	(build_accesses_from_assign): Set grp_assignment_read.
	(sort_and_splice_var_accesses): Propagate grp_assignment_read.
	(enum mark_read_status): New type.
	(analyze_access_subtree): Propagate grp_assignment_read, create
	accesses also if both direct_read and root->grp_assignment_read.

	* testsuite/gcc.dg/tree-ssa/sra-10.c: New test.

From-SVN: r158668
2010-04-23 16:52:06 +02:00
Martin Jambor 5c20baf14a re PR middle-end/43835 (IPA-SRA doesn't rewrite attributes)
2010-04-23  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/43835
	* tree-sra.c (ipa_sra_preliminary_function_checks): Check that the
	function does not have type attributes.

	* testsuite/gcc.c-torture/execute/pr43835.c: New test.

From-SVN: r158667
2010-04-23 16:43:10 +02:00
Martin Jambor acd6380155 gimple.h (create_tmp_reg): Declare.
2010-04-19  Martin Jambor  <mjambor@suse.cz>

	* gimple.h (create_tmp_reg): Declare.
	* gimplify.c (create_tmp_reg): New function.
	(gimplify_return_expr): Use create_tmp_reg.
	(gimplify_omp_atomic): Likewise.
	(gimple_regimplify_operands): Likewise.
	* tree-dfa.c (make_rename_temp): Likewise.
	* tree-predcom.c (predcom_tmp_var): Likewise.
	(reassociate_to_the_same_stmt): Likewise.
	* tree-sra.c (replace_uses_with_default_def_ssa_name): Likewise.
	(get_replaced_param_substitute): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
	* tree-ssa-phiopt.c (cond_store_replacement): Likewise.
	* tree-ssa-pre.c (get_representative_for): Likewise.
	(create_expression_by_pieces): Likewise.
	* tree-tailcall.c (adjust_return_value_with_ops): Likewise.
	(create_tailcall_accumulator): Likewise.

From-SVN: r158523
2010-04-19 19:58:54 +02:00
Martin Jambor 0f2ffb9ac5 tree-sra.c (replace_uses_with_default_def_ssa_name): New function.
2010-04-13  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (replace_uses_with_default_def_ssa_name): New function.
	(sra_modify_assign): Delete stmts loading dead data even if racc has no
	children.  Call replace_uses_with_default_def_ssa_name to handle
	SSA_NAES on lhs.

	* testsuite/gcc.dg/tree-ssa/sra-9.c: New test.

From-SVN: r158271
2010-04-13 15:47:34 +02:00
Richard Guenther 2ea9dc6459 ipa-reference.c (mark_load): Use get_base_address.
2010-04-07  Richard Guenther  <rguenther@suse.de>

	* ipa-reference.c (mark_load): Use get_base_address.
	(mark_store): Likewise.

	* tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Avoid
	inserting GIMPLE_NOPs into the IL.
	* tree-ssa-structalias.c (get_constraint_for_component_ref):
	Explicitly strip handled components and indirect references.
  
	* fold-const.c (fold_unary_loc): Do not strip qualifiers when
	folding address expressions.
	* gimple.c (gimple_ior_addresses_taken_1): Use get_base_address.
	* tree-ssa-alias.c (decl_refs_may_alias_p): Do not use
	operand_equal_p to compare decls.
	(ptr_deref_may_alias_decl_p): Likewise.
	* tree-ssa-operands.c (get_asm_expr_operands): Simplify
	* tree-ssa-forwprop.c (forward_propagate_into_gimple_cond):
	Handle reversed comparison ops.
	* tree-sra.c (asm_visit_addr): Use get_base_address.
	* ipa-prop.c (visit_store_addr_for_mod_analysis): Use
	get_base_address.
	* ipa-reference.c (mark_address): Use get_base_address.

From-SVN: r158069
2010-04-07 15:31:37 +00:00
Martin Jambor a775239672 tree-sra.c (find_param_candidates): Allow scalar va_list types.
2010-04-07  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (find_param_candidates): Allow scalar va_list types.

From-SVN: r158057
2010-04-07 13:43:38 +02:00
Martin Jambor ec24771ffd re PR tree-optimization/43347 (Warning about symbols generated by SRA being used uninitialized)
2010-03-17  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43347
	* tree-sra.c (create_access_replacement): Set TREE_NO_WARNING when the
	original base is DECL_ARTIFICIAL or DECL_IGNORED_P.

From-SVN: r157515
2010-03-17 13:02:35 +01:00
Martin Jambor 932e2e64b1 PR tree/optimization/43141
2010-03-15  Martin Jambor  <mjambor@suse.cz>

	PR tree/optimization/43141
	* tree-sra.c (create_abstract_origin): New function.
	(modify_function): Call create_abstract_origin.

From-SVN: r157456
2010-03-15 12:43:04 +01:00
Martin Jambor 76f76cd0e5 re PR tree-optimization/43164 (ice in completely_scalarize_record, at tree-sra.c:85)
2010-03-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43164
	PR tree-optimization/43191
	* tree-sra.c (type_consists_of_records_p): Reject records with
	zero-size bit-fields at the end.

	* testsuite/gcc.c-torture/compile/pr43164.c: New test.
	* testsuite/gcc.c-torture/compile/pr43191.c: Likewise.

From-SVN: r157232
2010-03-04 19:16:32 +01:00
Martin Jambor 746e119f8d re PR tree-optimization/43066 (ICE: SIGFPE with empty struct and va_arg)
2010-02-18  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43066
	* tree-sra.c (build_ref_for_offset_1): Return false on encountering an
	array with zero-sized element type.

	* testsuite/gcc.c-torture/compile/pr43066.c: New test.

From-SVN: r156863
2010-02-18 15:53:05 +01:00
Martin Jambor d354552496 re PR middle-end/42898 (volatile structures and compound literal initializers)
2010-02-08  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42898
	* tree-sra.c (build_accesses_from_assign): Do not mark in
	should_scalarize_away_bitmap if stmt has volatile ops.
	(sra_modify_assign): Do not process assigns piecemeal if if stmt
	has volatile ops.

From-SVN: r156599
2010-02-08 14:24:12 +01:00
Richard Guenther 44f89620d9 tree-sra.c (ptr_parm_has_direct_uses): Rewrite to be conservatively correct.
2010-01-31  Richard Guenther  <rguenther@suse.de>

	* tree-sra.c (ptr_parm_has_direct_uses): Rewrite to be
	conservatively correct.

From-SVN: r156413
2010-01-31 19:54:32 +00:00
Steve Ellcey 65c0a517d9 Makefile.in (tree-sra.o): Add $(EXPR_H) dependency.
2010-01-22  Steve Ellcey  <sje@cup.hp.com>

	* Makefile.in (tree-sra.o): Add $(EXPR_H) dependency.
	* tree-sra.c: Add include of expr.h.

From-SVN: r156181
2010-01-22 22:22:51 +00:00
Richard Henderson 002cda0a8b re PR tree-optimization/42833 (sra miscompiles qemu)
PR tree-opt/42833
	* tree-sra.c (sra_modify_assign): Delay re-gimplification of
	the RHS until after generate_subtree_copies has insertted its
	code before the current statement.

From-SVN: r156176
2010-01-22 10:52:01 -08:00
Martin Jambor 7744b697eb re PR tree-optimization/42585 (SRA is not good for structure copies with one replacement any more)
2010-01-21  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42585
	* tree-sra.c (struct access): New field grp_total_scalarization.
	(dump_access): Dump the new field.
	(should_scalarize_away_bitmap): New variable.
	(cannot_scalarize_away_bitmap): Likewise.
	(sra_initialize): Allocate new bitmaps.
	(sra_deinitialize): Free new bitmaps.
	(create_access_1): New function.
	(create_access): Parts moved to create_access_1.
	(type_consists_of_records_p): New function.
	(completely_scalarize_record): Likewise.
	(build_access_from_expr): Set bit in cannot_scalarize_away_bitmap.
	(build_accesses_from_assign): Set bits in should_scalarize_away_bitmap.
	(sort_and_splice_var_accesses): Hint groups with a total_scalarization
	access.
	(analyze_all_variable_accesses): Completely scalarize small eligible
	records.

	* testsuite/gcc.dg/tree-ssa/pr42585.c: New test.

From-SVN: r156156
2010-01-21 17:18:06 +01:00
Martin Jambor fff08961d5 tree-sra.c (build_ref_for_offset_1): Allow for zero size fields.
2010-01-21  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (build_ref_for_offset_1): Allow for zero size fields.

From-SVN: r156155
2010-01-21 17:04:12 +01:00
Martin Jambor 2f3cdcf502 re PR tree-optimization/42706 (ICE in gimple_op, at gimple.h:1634, (IPA SRA))
2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42706
	* tree-sra.c (encountered_recursive_call): New variable.
	(encountered_unchangable_recursive_call): Likewise.
	(sra_initialize): Initialize both new variables.
	(callsite_has_enough_arguments_p): New function.
	(scan_function): Call decl and flags check only for IPA-SRA, check
	whether there is a recursive call and whether it has enough arguments.
	(all_callers_have_enough_arguments_p): New function.
	(convert_callers): Look for recursive calls only when
	encountered_recursive_call is set.
	(ipa_early_sra): Bail out either if
	!all_callers_have_enough_arguments_p or
	encountered_unchangable_recursive_call.

	* testsuite/gcc.dg/ipa/pr42706.c: New testcase.

From-SVN: r155911
2010-01-14 19:00:34 +01:00
Martin Jambor 92e97cdd7d re PR tree-optimization/42714 (ICE in create_tmp_var, at gimplify.c:504)
2010-01-14  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42714
	* tree-sra.c (sra_ipa_modify_assign): Handle incompatible-type
	constructors specially.

	* gcc/testsuite/g++.dg/torture/pr42714.C: New test.

From-SVN: r155905
2010-01-14 14:29:44 +01:00
Martin Jambor 19656178bc re PR tree-optimization/42704 (ICE in verify_ssa after early SRA)
2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42704
	* tree-sra.c (sra_modify_assign): Do not delete assignments to
	SSA_NAMEs.

	* testsuite/g++.dg/torture/pr42704.C: New test.

From-SVN: r155865
2010-01-13 19:47:19 +01:00
Martin Jambor 6dc93b16c6 re PR tree-optimization/42703 (ICE in generate_subtree_copies with out of bounds array access)
2010-01-13  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42703
	* tree-sra.c (analyze_access_subtree): Check that we can build a
	reference to the original data within the aggregate.

	* testsuite/gcc.c-torture/compile/pr42703.c: New test.

From-SVN: r155863
2010-01-13 16:37:37 +01:00
Martin Jambor d05fe940b7 re PR tree-optimization/42157 (ICE building stage 1 libgcc: SEGV in compare_access_positions)
2010-01-07  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42157
	* tree-sra.c (compare_access_positions): Stabilize sort if both
	accesses have integer types, return zero immediately if they are the
	same.

From-SVN: r155689
2010-01-07 11:38:25 +01:00
Jakub Jelinek 566f27e42c re PR tree-optimization/42508 (wrong code with "-O1 -fipa-sra")
PR tree-optimization/42508
	* tree-sra.c (convert_callers): Check for recursive call
	by comparing cgraph nodes instead of decls.
	(modify_function): Call ipa_modify_formal_parameters also
	on all same_body aliases.

	* g++.dg/opt/pr42508.C: New test.

	* cgraphunit.c (cgraph_materialize_all_clones): Compare
	cgraph nodes when checking for same_body aliases.

From-SVN: r155640
2010-01-05 09:40:50 +01:00
Martin Jambor caee6ca1dc re PR tree-optimization/42398 (internal compiler error: in sra_modify_expr, at tree-sra.c:2175)
2010-01-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42398
	* tree-sra.c (struct access): Removed flag grp_different_types.
	(dump_access): Do not dump the removed flag.
	(sort_and_splice_var_accesses): Do not set the removed flag.
	(sra_modify_expr): Check for type compatibility directly.

	* testsuite/gcc.c-torture/compile/pr42398.c: New test.

From-SVN: r155631
2010-01-04 19:25:14 +01:00
Richard Guenther aecd4d8180 re PR debug/42455 ("-fcompare-debug failure" at -O2 in 'recent' builds)
2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR debug/42455
	* tree-sra.c (analyze_all_variable_accesses): Work in DECL_UID
	order.

From-SVN: r155559
2010-01-01 20:22:17 +00:00
Richard Guenther 1bea309889 re PR tree-optimization/42357 (another ice in create_tmp_var)
2009-12-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42357
	* tree-sra.c (sra_modify_assign): Do not tear apart struct copies.

	* g++.dg/torture/pr42357.C: New testcase.

From-SVN: r155193
2009-12-13 17:36:20 +00:00
Martin Jambor d557591da1 re PR tree-optimization/42237 (internal compiler error: verify_stmts failed)
2009-12-01  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42237
	* tree-sra.c (sra_ipa_modify_assign): Split gimple_reg_type assignments
	in between references into two.

	* testsuite/gcc.c-torture/compile/pr42237.c: New test.

From-SVN: r154874
2009-12-01 18:39:44 +01:00
Martin Jambor 9fda11a2ec re PR middle-end/42196 (ICE when SRAing partial assigments to complex number)
2009-11-30  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42196
	* tree-sra.c (struct access): New field grp_different_types.
	(dump_access): Dump grp_different_types.
	(compare_access_positions): Prefer scalars and vectors over other
	scalar types.
	(sort_and_splice_var_accesses): Set grp_different_types if appropriate.
	(sra_modify_expr): Use the original also when dealing with a complex
	 or vector group accessed as multiple types.

	* testsuite/gcc.c-torture/compile/pr42196-1.c: New test.
	* testsuite/gcc.c-torture/compile/pr42196-2.c: New test.
	* testsuite/gcc.c-torture/compile/pr42196-3.c: New test.

From-SVN: r154834
2009-11-30 18:59:57 +01:00
Martin Jambor c4ea52007a re PR middle-end/42006 (Termination problem with -O2 and -O3)
2009-11-27  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42006
	* tree-sra.c (get_replaced_param_substitute): Call create_tmp_var
	instead of create_tmp_var.  Set DECL_GIMPLE_REG_P to one manually
	for vector and complex types.
	(get_adjustment_for_base): Describe return value in the comment.

	* testsuite/gcc.c-torture/execute/pr42006.c: New test.

From-SVN: r154715
2009-11-27 23:34:40 +01:00
Martin Jambor 09f0dc451d re PR tree-optimization/42154 (Wrong code from (early) SRA)
2009-11-24  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42154
	* tree-sra.c (struct access): Added comments.
	(sra_modify_expr): Build references to the old aggregate with
	build_ref_for_offset instead of reusing access->expr.
	(load_assign_lhs_subreplacements): Likewise.

	* testsuite/gcc.c-torture/execute/pr42154.c: New test.

From-SVN: r154493
2009-11-24 11:56:14 +01:00
Martin Jambor c6a2c25d12 re PR middle-end/42025 (ICE verify_stmts failed (non-trivial conversion at assignment))
2009-11-21  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42025
	* tree-sra.c (access_precludes_ipa_sra_p): New function.
	(splice_param_accesses): Check all accesses by calling
	access_precludes_ipa_sra_p.
	(sra_ipa_modify_expr): Rename argument erite to dont_convert and do
	not convert types if it is true.
	(sra_ipa_modify_assign): Convert types in case of mismatch.

	* testsuite/gcc.c-torture/compile/pr42025-1.c: New test.
	* testsuite/gcc.c-torture/compile/pr42025-2.c: New test.

From-SVN: r154413
2009-11-21 23:56:36 +01:00
Martin Jambor 30a20e9731 tree-sra.c (struct access): Changed comment of next_sibling field.
2009-11-04  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (struct access): Changed comment of next_sibling field.
	(analyze_modified_params): Loop over accesses of a group rather than
	over all with the ame base, pass a common bitmap to
	walk_aliased_vdefs.
	(unmodified_by_ref_scalar_representative): Build link lists of
	accesses of a group.
	(splice_param_accesses): Likewise.

From-SVN: r153935
2009-11-05 13:09:08 +01:00
Martin Jambor 2b93f88dc5 re PR tree-optimization/41750 (IPA-SRA is broken)
2009-11-02  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/41750
	* tree-sra.c (analyze_modified_params): Loop over all
	representatives of components of a parameter.

	* testsuite/gcc.c-torture/execute/pr41750.c: New test.

From-SVN: r153809
2009-11-02 15:13:49 +01:00
Martin Jambor 3d158124d5 tree-sra.c (build_ref_for_offset_1): Remove a comment.
2009-10-30  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (build_ref_for_offset_1): Remove a comment.

From-SVN: r153751
2009-10-30 15:38:48 +01:00
Martin Jambor 8a1326b392 re PR tree-optimization/41775 (IPA-SRA: ice in rewrite_stmt, at tree-into-ssa.c:1302)
2009-10-29  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/41775
	* tree-sra.c (build_ref_for_offset): Unshare *expr if not NULL.
	(generate_subtree_copies): Do not unshare agg.
	(load_assign_lhs_subreplacements): Do not unshare rhs.
	(sra_modify_assign): Do not unshare exprs.
	(propagate_subacesses_accross_link): Renamed to
	propagate_subaccesses_across_link.

	* testsuite/g++.dg/torture/pr41775.C: New testcase.

From-SVN: r153699
2009-10-29 13:40:48 +01:00
Eric Botcazou a1aa17011f tree-sra.c (build_ref_for_offset_1): Skip fields without size or with size that can't be represented as a host integer.
* tree-sra.c (build_ref_for_offset_1) <RECORD_TYPE>: Skip fields
	without size or with size that can't be represented as a host integer.

From-SVN: r153008
2009-10-20 09:19:17 +00:00
Eric Botcazou d7c79c4daa * tree-sra.c (build_ref_for_offset_1): Update comment.
From-SVN: r152893
2009-10-16 06:56:34 +00:00
Martin Jambor 6096017ee3 re PR middle-end/12392 (very long optimized compile)
2009-10-01  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/12392
	* tree-sra.c (convert_callers): Do not call
	compute_inline_parameters on one caller more than once.

From-SVN: r152368
2009-10-01 13:48:24 +02:00
Martin Jambor 1e9fb3de50 re PR bootstrap/41395 (Revision 151800 failed bootstrap)
2009-10-01  Martin Jambor  <mjambor@suse.cz>

	PR bootstrap/41395
	* tree-sra.c (is_va_list_type): New function.
	(find_var_candidates): Call is_va_list_type.
	(find_param_candidates): Check that the type or the type pointed
	to are not va_list types.

From-SVN: r152366
2009-10-01 13:30:12 +02:00
Martin Jambor 07ffa034dd common.opt (fipa-sra): New switch.
2009-09-17  Martin Jambor  <mjambor@suse.cz>

	* common.opt (fipa-sra): New switch.
	* opts.c (decode_options): Turn flag_ipa_sra on for opt2.
	* timevar.def (TV_IPA_SRA): New timevar.
	* params.def (ipa-sra-ptr-growth-factor): New parameter.
	* doc/invoke.texi: Document -fipa-sra and ipa-sra-ptr-growth-factor.
	* tree-sra.c: Include cgraph.c.
	(enum sra_mode): Added SRA_MODE_EARLY_IPA.
	(struct access): Added fields stmt, grp_maybe_modified, grp_scalar_ptr
	and grp_not_necessarilly_dereferenced.
	(func_param_count): New variable.
	(encountered_apply_args): New variable.
	(bb_dereferences): New variable.
	(final_bbs): New variable.
	(no_accesses_representant): New variable.
	(no_accesses_p): New function.
	(dump_access): Dump the new fields.
	(sra_initialize): Set encountered_apply_args to false.
	(get_ssa_base_param): New function.
	(mark_parm_dereference): New function.
	(create_access): Caring for INIDRECT_REFs and different handling of
	varialble length accesses in early IPA SRA.  Store the stmt - a new
	parameter - to the new access.
	(build_access_from_expr_1): New parameter stmt, passed to
	create_access.  Handle INDIRECT_REFs.
	(build_access_from_expr): Pass the current statement to
	build_access_from_expr_1.
	(disqualify_ops_if_throwing_stmt): Trigger only in intraprocedural
	passes.
	(build_accesses_from_assign): Pass the current statement to
	build_access_from_expr_1.  Do not create assign links in IPA-SRA.
	(scan_function): Call handle_ssa_defs on phi nodes.  Set bits in
	final_bbs when necessary.  Check for calls to __builtin_apply_args.
	Fixup EH info if anythng was changed.
	(is_unused_scalar_param): New function.
	(ptr_parm_has_direct_uses): New function.
	(find_param_candidates): New function.
	(mark_maybe_modified): New function.
	(analyze_modified_params): New function.
	(propagate_dereference_distances): New function.
	(dump_dereferences_table): New function.
	(analyze_caller_dereference_legality): New function.
	(unmodified_by_ref_scalar_representative): New function.
	(splice_param_accesses): New function.
	(decide_one_param_reduction): New function.
	(enum ipa_splicing_result): New type.
	(splice_all_param_accesses): New function.
	(get_param_index): New function.
	(turn_representatives_into_adjustments): New function.
	(analyze_all_param_acesses): New function.
	(get_replaced_param_substitute): New function.
	(get_adjustment_for_base): New function.
	(replace_removed_params_ssa_names): New function.
	(sra_ipa_reset_debug_stmts): New function.
	(sra_ipa_modify_expr): New function.
	(sra_ipa_modify_assign): New function.
	(convert_callers): New function.
	(modify_function): New function.
	(ipa_sra_preliminary_function_checks): New function.
	(ipa_early_sra): New function.
	(ipa_early_sra_gate): New function.
	(pass_early_ipa_sra): New variable.
	* Makefile.in (tree-sra.o): Add cgraph.h to dependencies.
	
	Testsuite:

	* gcc.dg/struct/wo_prof_escape_arg_to_local.c: Do not run IPA-SRA.
	* gcc.dg/ipa/ipa-sra-1.c: New test.
	* gcc.dg/ipa/ipa-sra-2.c: New test.
	* gcc.dg/ipa/ipa-sra-3.c: New test.
	* gcc.dg/ipa/ipa-sra-4.c: New test.
	* gcc.dg/ipa/ipa-sra-5.c: New test.
	* gcc.c-torture/execute/ipa-sra-1.c: New test.
	* gcc.c-torture/execute/ipa-sra-2.c: New test.

From-SVN: r151800
2009-09-17 13:35:38 +02:00
Richard Henderson 1d65f45cfa Squash commit of EH in gimple
From-SVN: r151696
2009-09-14 12:18:58 -07:00