Commit Graph

227 Commits

Author SHA1 Message Date
Jie Zhang 65e2958885 re PR target/44290 (__naked attribute is broken)
PR target/44290
	Revert
	2010-07-23  Jie Zhang  <jie@codesourcery.com>
	* tree-sra.c (ipa_sra_preliminary_function_checks): Return
	false if ! tree_versionable_function_p.

From-SVN: r162579
2010-07-27 17:33:30 +00:00
Martin Jambor 8cbeddcc33 re PR tree-optimization/44914 (ICE: in calc_dfs_tree, at dominance.c:395 with -fipa-sra -fnon-call-exceptions)
2010-07-23  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/44914
	* tree-sra.c (sra_modify_function_body): Return true if CFG was
	changed, add purging dead eh edges.
	(ipa_sra_modify_function_body): Return true if CFG was changed,
	simplify purging dead eh edges.
	(modify_function): Return true if CFG was changed.
	(perform_intra_sra): Add TODO_cleanup_cfg to the return value if CFG
	was changed.
	(ipa_early_sra): Likewise.

	* testsuite/g++.dg/tree-ssa/pr44914.C:  New test.

From-SVN: r162468
2010-07-23 18:31:48 +02:00
Jie Zhang 6104449219 re PR target/44290 (__naked attribute is broken)
PR target/44290
	* attribs.c (decl_attributes): Insert "noinline" and "noclone"
	if "naked".
	* tree-sra.c (ipa_sra_preliminary_function_checks): Return
	false if ! tree_versionable_function_p.

	testsuite/
	PR target/44290
	* gcc.dg/pr44290-1.c: New test.
	* gcc.dg/pr44290-2.c: New test.

From-SVN: r162466
2010-07-23 14:47:46 +00:00
Jie Zhang a23c4464d8 tree-sra.c (ipa_sra_preliminary_function_checks): Dump proper words when !tree_versionable_function_p.
* tree-sra.c (ipa_sra_preliminary_function_checks): Dump
	proper words when !tree_versionable_function_p.

From-SVN: r162453
2010-07-23 10:52:43 +00:00
Martin Jambor 56a42add96 re PR tree-optimization/44891 (non-trivial conversion ICE from early SRA)
2010-07-22  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/44891
	* tree-sra.c: Include gimple-pretty-print.h.
	(replace_uses_with_default_def_ssa_name): Renamed to
	get_repl_default_def_ssa_name, return the new SSA name instead of
	replacing the old one.
	(sra_modify_assign): Dump a message when removing a load, if the LHS
	is an SSA_NAME, do not do any propagation, just set the RHS to a
	default definition SSA NAME, type convert if necessary.
	* Makefile.in (tree-sra.o): Add gimple-pretty-print.h to dependencies.

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

From-SVN: r162413
2010-07-22 14:52:14 +02:00
Martin Jambor 75a75e91fd re PR tree-optimization/44900 (The variable of SSE will be broken)
2010-07-21  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/44900
	* tree-sra.c (load_assign_lhs_subreplacements): Updated comments.
	(sra_modify_assign): Move gsi to the next statmenent unconditionally.

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

From-SVN: r162375
2010-07-21 16:17:11 +02:00
Nathan Froyd 910ad8dee5 tree.h (DECL_CHAIN): Define.
gcc/
	* tree.h (DECL_CHAIN): Define.
	* alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-decl.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.
	* cfgexpand.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/winnt-cxx.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/iq2000/iq2000.c: Likewise.
	* config/mep/mep.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/pa/som.h: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/symbian-cxx.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/vxworks.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* coverage.c: Likewise.
	* dbxout.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* expr.c: Likewise.
	* function.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimplify.c: Likewise.
	* integrate.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-type-escape.c: Likewise.
	* langhooks.c: Likewise.
	* lto-cgraph.c: Likewise.
	* omp-low.c: Likewise.
	* stor-layout.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.

gcc/ada/
	* gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	* gcc-interface/utils2.c: Likewise.

gcc/c-family/
	* c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-format.c: Likewise.

gcc/cp/
	* cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* call.c: Likewise.
	* class.c: Likewise.
	* cp-gimplify.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* mangle.c: Likewise.
	* name-lookup.c: Likewise.
	* optimize.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

gcc/fortran/
	* f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* trans-common.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-types.c: Likewise.
	* trans.c: Likewise.

gcc/java/
	* java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* boehm.c: Likewise.
	* class.c: Likewise.
	* decl.c: Likewise.
	* expr.c: Likewise.
	* jcf-parse.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.

gcc/objc/
	* objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN.

gcc/testsuite/
	* g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN
	with DECL_CHAIN.

From-SVN: r162223
2010-07-15 14:31:28 +00:00
Richard Guenther 70f348148c re PR middle-end/42834 (memcpy folding overeager)
2010-07-01  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42834
	PR middle-end/44468
	* doc/gimple.texi (is_gimple_mem_ref_addr): Document.
	* doc/generic.texi (References to storage): Document MEM_REF.
	* tree-pretty-print.c (dump_generic_node): Handle MEM_REF.
	(print_call_name): Likewise.
	* tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF.
	(build_simple_mem_ref_loc): New function.
	(mem_ref_offset): Likewise.
	* tree.h (build_simple_mem_ref_loc): Declare.
	(build_simple_mem_ref): Define.
	(mem_ref_offset): Declare.
	* fold-const.c: Include tree-flow.h.
	(operand_equal_p): Handle MEM_REF.
	(build_fold_addr_expr_with_type_loc): Likewise.
	(fold_comparison): Likewise.
	(fold_unary_loc): Fold
	VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>.
	(fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2],
	fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2].
	* tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF.
	(ptr_deref_may_alias_ref_p_1): Likewise.
	(ao_ref_base_alias_set): Properly differentiate base object for
	offset and TBAA.
	(ao_ref_init_from_ptr_and_size): Use MEM_REF.
	(indirect_ref_may_alias_decl_p): Handle MEM_REFs properly.
	(indirect_refs_may_alias_p): Likewise.
	(refs_may_alias_p_1): Likewise.  Remove pointer SSA name def
	chasing code.
	(ref_maybe_used_by_call_p_1): Handle MEM_REF.
	(call_may_clobber_ref_p_1): Likewise.
	* dwarf2out.c (loc_list_from_tree): Handle MEM_REF.
	* expr.c (expand_assignment): Handle MEM_REF.
	(store_expr): Handle MEM_REFs from STRING_CSTs.
	(store_field): If expanding a MEM_REF of a non-addressable
	decl use bitfield operations.
	(get_inner_reference): Handle MEM_REF.
	(expand_expr_addr_expr_1): Likewise.
	(expand_expr_real_1): Likewise.
	* tree-eh.c (tree_could_trap_p): Handle MEM_REF.
	* alias.c (ao_ref_from_mem): Handle MEM_REF.
	(get_alias_set): Likewise.  Properly handle VIEW_CONVERT_EXPRs.
	* tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF.
	(dr_analyze_indices): Likewise.
	(dr_analyze_alias): Likewise.
	(object_address_invariant_in_loop_p): Likewise.
	* gimplify.c (mark_addressable): Handle MEM_REF.
	(gimplify_cond_expr): Build MEM_REFs.
	(gimplify_modify_expr_to_memcpy): Likewise.
	(gimplify_init_ctor_preeval_1): Handle MEM_REF.
	(gimple_fold_indirect_ref): Adjust.
	(gimplify_expr): Handle MEM_REF.  Gimplify INDIRECT_REF to MEM_REF.
	* tree.def (MEM_REF): New tree code.
	* tree-dfa.c: Include toplev.h.
	(get_ref_base_and_extent): Handle MEM_REF.
	(get_addr_base_and_unit_offset): New function.
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF.
	* gimple-fold.c (may_propagate_address_into_dereference): Handle
	MEM_REF.
	(maybe_fold_offset_to_array_ref): Allow possibly out-of bounds
	accesses if the array has just one dimension.  Remove always true
	parameter.  Do not require type compatibility here.
	(maybe_fold_offset_to_component_ref): Remove.
	(maybe_fold_stmt_indirect): Remove.
	(maybe_fold_reference): Remove INDIRECT_REF handling.
	Fold back to non-MEM_REF.
	(maybe_fold_offset_to_address): Simplify.  Deal with type
	mismatches here.
	(maybe_fold_reference): Likewise.
	(maybe_fold_stmt_addition): Likewise.  Also handle
	&ARRAY + I in addition to &ARRAY[0] + I.
	(fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs.
	(gimple_get_relevant_ref_binfo): Handle MEM_REF.
	* cfgexpand.c (expand_debug_expr): Handle MEM_REF.
	* tree-ssa.c (useless_type_conversion_p): Make most pointer
	conversions useless.
	(warn_uninitialized_var): Handle MEM_REF.
	(maybe_rewrite_mem_ref_base): New function.
	(execute_update_addresses_taken): Implement re-writing of MEM_REFs
	to SSA form.
	* tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove
	INDIRECT_REF handling.
	(copy_tree_body_r): Handle MEM_REF.
	* gimple.c (is_gimple_addressable): Adjust.
	(is_gimple_address): Likewise.
	(is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with
	invariant base are invariant.
	(is_gimple_min_lval): Adjust.
	(is_gimple_mem_ref_addr): New function.
	(get_base_address): Handle MEM_REF.
	(count_ptr_derefs): Likewise.
	(get_base_loadstore): Likewise.
	* gimple.h (is_gimple_mem_ref_addr): Declare.
	(gimple_call_fndecl): Handle invariant MEM_REF addresses.
	* tree-cfg.c (verify_address): New function, split out from ...
	(verify_expr): ... here.  Use for verifying ADDR_EXPRs and
	the address operand of MEM_REFs.  Verify MEM_REFs.  Reject
	INDIRECT_REFs.
	(verify_types_in_gimple_min_lval): Handle MEM_REF.  Disallow
	INDIRECT_REF.  Allow conversions.
	(verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of
	a register does not change its size.
	(verify_types_in_gimple_reference): Verify MEM_REF.
	(verify_gimple_assign_single): Disallow INDIRECT_REF.
	Handle MEM_REF.
	* tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable):
	New.
	(mark_address_taken): Handle MEM_REF.
	(get_indirect_ref_operands): Pass through opf_not_non_addressable.
	(get_asm_expr_operands): Pass opf_not_non_addressable.
	(get_expr_operands): Handle opf_[not_]non_addressable.
	Handle MEM_REF.  Remove INDIRECT_REF handling.
	* tree-vrp.c: (check_array_ref): Handle MEM_REF.
	(search_for_addr_array): Likewise.
	(check_array_bounds): Likewise.
	(vrp_stmt_computes_nonzero): Adjust for MEM_REF.
	* tree-ssa-loop-im.c (for_each_index): Handle MEM_REF.
	(ref_always_accessed_p): Likewise.
	(gen_lsm_tmp_name): Likewise.  Handle ADDR_EXPR.
	* tree-complex.c (extract_component): Do not handle INDIRECT_REF.
	Handle MEM_REF.
	* cgraphbuild.c (mark_load): Properly check for NULL result
	from get_base_address.
	(mark_store): Likewise.
	* tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF.
	* tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF
	handling for MEM_REF.
	* tree-scalar-evolution.c (follow_ssa_edge_expr): Handle
	&MEM[ptr + CST] similar to POINTER_PLUS_EXPR.
	* builtins.c (stabilize_va_list_loc): Use the function ABI
	valist type if we couldn't canonicalize the argument type.
	Always dereference with the canonical va-list type.
	(maybe_emit_free_warning): Handle MEM_REF.
	(fold_builtin_memory_op): Simplify and handle MEM_REFs in folding
	memmove to memcpy.
	* builtins.c (fold_builtin_memory_op): Use ref-all types
	for all memcpy foldings.
	* omp-low.c (build_receiver_ref): Adjust for MEM_REF.
	(build_outer_var_ref): Likewise.
	(scan_omp_1_op): Likewise.
	(lower_rec_input_clauses): Likewise.
	(lower_lastprivate_clauses): Likewise.
	(lower_reduction_clauses): Likewise.
	(lower_copyprivate_clauses): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	(expand_omp_atomic_mutex): Likewise.
	(create_task_copyfn): Likewise.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF.
	Remove old union trick.  Initialize constant offsets.
	(ao_ref_init_from_vn_reference): Likewise.  Do not handle
	INDIRECT_REF.  Init base_alias_set properly.
	(vn_reference_lookup_3): Replace INDIRECT_REF handling with
	MEM_REF.
	(vn_reference_fold_indirect): Adjust for MEM_REFs.
	(valueize_refs): Fold MEM_REFs.  Re-evaluate constant offset
	for ARRAY_REFs.
	(may_insert): Remove.
	(visit_reference_op_load): Do not test may_insert.
	(run_scc_vn): Remove parameter, do not fiddle with may_insert.
	* tree-ssa-sccvn.h (struct vn_reference_op_struct): Add
	a field to store the constant offset this op applies.
	(run_scc_vn): Adjust prototype.
	* cgraphunit.c (thunk_adjust): Adjust for MEM_REF.
	* tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with
	MEM_REF.  Propagate &foo + CST as &MEM[&foo, CST].  Do not
	bother about volatile qualifiers on pointers.
	(fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF.
	* tree-ssa-loop-ivopts.c
	* tree-ssa-loop-ivopts.c (determine_base_object): Adjust
	for MEM_REF.
	(strip_offset_1): Likewise.
	(find_interesting_uses_address): Replace INDIRECT_REF handling with
	MEM_REF handling.
	(get_computation_cost_at): Likewise.
	* ipa-pure-const.c (check_op): Handle MEM_REF.
	* tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF.
	* tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF
	and constants.
	* ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF.
	* tree-parloops.c (take_address_of): Adjust for MEM_REF.
	(eliminate_local_variables_1): Likewise.
	(create_call_for_reduction_1): Likewise.
	(create_loads_for_reductions): Likewise.
	(create_loads_and_stores_for_name): Likewise.
	* matrix-reorg.c (may_flatten_matrices_1): Sanitize.
	(ssa_accessed_in_tree): Handle MEM_REF.
	(ssa_accessed_in_assign_rhs): Likewise.
	(update_type_size): Likewise.
	(analyze_accesses_for_call_stmt): Likewise.
	(analyze_accesses_for_assign_stmt): Likewise.
	(transform_access_sites): Likewise.
	(transform_allocation_sites): Likewise.
	* tree-affine.c (tree_to_aff_combination): Handle MEM_REF.
	* tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do
	not handle INDIRECT_REF.
	* tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF.
	(cond_store_replacement): Likewise.
	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
	MEM_REF, no not handle INDIRECT_REFs.
	(insert_into_preds_of_block): Properly initialize avail.
	(phi_translate_1): Fold MEM_REFs.  Re-evaluate constant offset
	for ARRAY_REFs.  Properly handle reference lookups that
	require a bit re-interpretation.
	(can_PRE_operation): Do not handle INDIRECT_REF.  Handle MEM_REF.
	* tree-sra.c
	* tree-sra.c (build_access_from_expr_1): Handle MEM_REF.
	(build_ref_for_offset_1): Remove.
	(build_ref_for_offset): Build MEM_REFs.
	(gate_intra_sra): Disable for now.
	(sra_ipa_modify_expr): Handle MEM_REF.
	(ipa_early_sra_gate): Disable for now.
	* tree-sra.c (create_access): Swap INDIRECT_REF handling for
	MEM_REF handling.
	(disqualify_base_of_expr): Likewise.
	(ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for
	MEM_REF handling.
	(sra_ipa_modify_expr): Remove INDIRECT_REF handling.
	Use mem_ref_offset.  Remove bogus folding.
	(build_access_from_expr_1): Properly handle MEM_REF for
	non IPA-SRA.
	(make_fancy_name_1): Add support for MEM_REF.
	* tree-predcom.c (ref_at_iteration): Handle MEM_REFs.
	* tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF.
	* ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF.
	(compute_complex_ancestor_jump_func): Likewise.
	(ipa_analyze_virtual_call_uses): Likewise.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace
	INDIRECT_REF folding with more generalized MEM_REF folding.
	(tree_ssa_forward_propagate_single_use_vars): Adjust accordingly.
	(forward_propagate_addr_into_variable_array_index): Also handle
	&ARRAY + I in addition to &ARRAY[0] + I.
	* tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF.
	* tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that
	creates assignments with overlap.
	* tree-nested.c (get_static_chain): Adjust for MEM_REF.
	(get_frame_field): Likewise.
	(get_nonlocal_debug_decl): Likewise.
	(convert_nonlocal_reference_op): Likewise.
	(struct nesting_info): Add mem_refs pointer-set.
	(create_nesting_tree): Allocate it.
	(convert_local_reference_op): Insert to be folded mem-refs.
	(fold_mem_refs): New function.
	(finalize_nesting_tree_1): Perform defered folding of mem-refs 
	(free_nesting_tree): Free the pointer-set.
	* tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF.
	(vectorizable_load): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF.
	(propagate_with_phi): Likewise.
	* tree-object-size.c (addr_object_size): Handle MEM_REFs
	instead of INDIRECT_REFs.
	(compute_object_offset): Handle MEM_REF.
	(plus_stmt_object_size): Handle MEM_REF.
	(collect_object_sizes_for): Dispatch to plus_stmt_object_size
	for &MEM_REF.
	* tree-flow.h (get_addr_base_and_unit_offset): Declare.
	(symbol_marked_for_renaming): Likewise.
	* Makefile.in (tree-dfa.o): Add $(TOPLEV_H).
	(fold-const.o): Add $(TREE_FLOW_H).
	* tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF.
	(find_func_clobbers): Likewise.
	* ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF.
	(decompose_access): Likewise.
	(replace_field_acc): Likewise.
	(replace_field_access_stmt): Likewise.
	(insert_new_var_in_stmt): Likewise.
	(get_stmt_accesses): Likewise.
	(reorg_structs_drive): Disable.
	* config/i386/i386.c (ix86_va_start): Adjust for MEM_REF.
	(ix86_canonical_va_list_type): Likewise.

	cp/
	* cp-gimplify.c (cp_gimplify_expr): Open-code the rhs
	predicate we are looking for, allow non-gimplified
	INDIRECT_REFs.

	testsuite/
	* gcc.c-torture/execute/20100316-1.c: New testcase.
	* gcc.c-torture/execute/pr44468.c: Likewise.
	* gcc.c-torture/compile/20100609-1.c: Likewise.
	* gcc.dg/volatile2.c: Adjust.
	* gcc.dg/plugin/selfassign.c: Likewise.
	* gcc.dg/pr36902.c: Likewise.
	* gcc.dg/tree-ssa/foldaddr-2.c: Remove.
	* gcc.dg/tree-ssa/foldaddr-3.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-8.c: Adjust.
	* gcc.dg/tree-ssa/pr17141-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-13.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-14.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise.
	* gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise.
	* gcc.dg/tree-ssa/20030807-7.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-10.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
	* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-1.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-2.c: Likewise.
	* gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise.
	* gcc.dg/tree-ssa/ssa-pre-26.c: Likewise.
	* gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise.
	* gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise.
	* gcc.dg/tree-ssa/ssa-pre-7.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-5.c: Likewise.
	* gcc.dg/struct/w_prof_two_strs.c: XFAIL.
	* gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise.
	* gcc.dg/struct/wo_prof_global_var.c: Likewise.
	* gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise.
	* gcc.dg/struct/w_prof_local_array.c: Likewise.
	* gcc.dg/struct/w_prof_single_str_global.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_str_init.c: Likewise.
	* gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise.
	* gcc.dg/struct/w_prof_global_array.c: Likewise.
	* gcc.dg/struct/wo_prof_array_field.c: Likewise.
	* gcc.dg/struct/wo_prof_single_str_local.c: Likewise.
	* gcc.dg/struct/w_prof_local_var.c: Likewise.
	* gcc.dg/struct/wo_prof_two_strs.c: Likewise.
	* gcc.dg/struct/wo_prof_empty_str.c: Likewise.
	* gcc.dg/struct/wo_prof_local_array.c: Likewise.
	* gcc.dg/struct/w_prof_global_var.c: Likewise.
	* gcc.dg/struct/wo_prof_single_str_global.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise.
	* gcc.dg/struct/wo_prof_global_array.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_return.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise.
	* gcc.dg/struct/wo_prof_double_malloc.c: Likewise.
	* gcc.dg/struct/w_ratio_cold_str.c: Likewise.
	* gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise.
	* gcc.dg/struct/wo_prof_local_var.c: Likewise.
	* gcc.dg/tree-prof/stringop-1.c: Adjust.
	* g++.dg/tree-ssa/pr31146.C: Likewise.
	* g++.dg/tree-ssa/copyprop-1.C: Likewise.
	* g++.dg/tree-ssa/pr33604.C: Likewise.
	* g++.dg/plugin/selfassign.c: Likewise.
	* gfortran.dg/array_memcpy_3.f90: Likewise.
	* gfortran.dg/array_memcpy_4.f90: Likewise.
	* c-c++-common/torture/pr42834.c: New testcase.

From-SVN: r161655
2010-07-01 08:49:19 +00:00
Martin Jambor bb8e5dcaa4 tree-sra.c (convert_callers): New parameter, change fndecls of recursive calls.
2010-06-26  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (convert_callers): New parameter, change fndecls of
	recursive calls.
	(modify_function): Pass the old decl to convert_callers.

	* testsuite/gcc.dg/ipa/ipa-sra-6.c: New test.

From-SVN: r161503
2010-06-28 18:47:55 +02:00
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