summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
Commit message (Collapse)AuthorAgeFilesLines
* [multiple changes]Andrew Pinski2007-06-151-38/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> Zdenek Dvorak <dvorakz@suse.cz> Richard Guenther <rguenther@suse.de> Kaz Kojima <kkojima@gcc.gnu.org> * tree-vrp.c (compare_values_warnv): Convert val2 to the type of val1. (extract_range_from_assert): Create POINTER_PLUS_EXPR for pointer types. (extract_range_from_binary_expr): Handle only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR for pointer types. * doc/c-tree.texi (POINTER_PLUS_EXPR): Document. * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (number_of_iterations_lt_to_ne): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (assert_loop_rolls_lt): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (number_of_iterations_le): Likewise. (expand_simple_operations): POINTER_PLUS_EXPR are simple also. (derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just like PLUS_EXPR and MINUS_EXPR. * tree-pretty-print.c (dump_generic_node): Handle POINTER_PLUS_EXPR. (op_prio): Likewise. (op_symbol_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-ssa-loop-manip.c (create_iv): Handle pointer base specially. * tree-tailcall.c (process_assignment): Mention POINTER_PLUS_EXPR in a TODO comment. * tree.c (build2_stat): Assert when trying to use PLUS_EXPR or MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR not used with a pointer and an integer type. * tree-scalar-evolution.c (add_to_evolution_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. (follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like PLUS_EXPR except for the right hand side's type will be sizetype. (interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR. (fold_used_pointer_cast): Kill. (pointer_offset_p): Kill. (fold_used_pointer): Kill. (pointer_used_p): Kill. (analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't call fold_used_pointer. (instantiate_parameters_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. Handle POINTER_PLUS_EXPR as PLUS_EXPR. * builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (std_gimplify_va_arg_expr): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. (std_expand_builtin_va_start): Use sizetype for the call to make_tree and then convert to the pointer type. (fold_builtin_memchr): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for adding to a pointer. (std_gimplify_va_arg_expr): Use fold_build2 for the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast the operands to sizetype first and then cast the BIT_AND_EXPR back to the pointer type. * fold-const.c (build_range_check): Handle pointer types specially. (extract_array_ref): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Make sure the offset is converted to sizetype. (try_move_mult_to_index): Strip the NOPs from the offset. Remove code argument and replace all uses with PLUS_EXPR. (fold_to_nonsharp_ineq_using_bound): Handle pointer types specially. Don't use a pointer type for MINUS_EXPR. (fold_unary): Handle for (T1)(X op Y), only p+ as that is the only as that can be handled for binary operators now. (fold_binary <case POINTER_PLUS_EXPR>): Add folding of POINTER_PLUS_EXPR. <case PLUS_EXPR>: Add folding of PTR+INT into PTR p+ INT. Don't call try_move_mult_to_index. <case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B) into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into (PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies. Don't call try_move_mult_to_index. (tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR. (tree_expr_nonzero_p): Likewise. (fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead of PLUS_EXPR for the complex expression folding. * tree-chrec.c (chrec_fold_plus_poly_poly): If the first chrec is a pointer type, then the second should be sizetype and not the first's type. For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR instead of PLUS_EXPR. When either operand is zero, convert the other operand. (chrec_apply): Use chrec_convert_rhs on the argument x instead of chrec_convert. (reset_evolution_in_loop): For pointer types, the new_evol should be sizetype. (convert_affine_scev): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_convert_rhs): New function. (chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. * tree-chrec.h (chrec_convert_rhs): New prototype. (build_polynomial_chrec): For pointer types, the right hand * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Remove subtraction case as it is always addition now. Make sure the offset is converted to sizetype. (fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially. Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before. * tree-ssa-loop-ivopts.c (determine_base_object): Abort for PLUS_EXPR in pointer type. Handle POINTER_PLUS_EXPR. (tree_to_aff_combination): Likewise. (force_expr_to_var_cost): Likewise. (force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR of pointer types. * tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (check_va_list_escapes): Likewise. (check_all_va_list_escapes): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1): Handle POINT_PLUS_EXPR as a PLUS_EXPR. * expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR. (string_constant): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): When adding the offset to the base, use POINTER_PLUS_EXPR. (add_to_parts): Convert the index to sizetype. (create_mem_ref): Create A POINTER_PLUS_EXPR for the one case. * matrix-reorg.c (collect_data_for_malloc_call): Stmt will now only be either INDIRECT_REF and POINTER_PLUS_EXPR. Offset only holds something for PLUS_EXPR. (ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as a PLUS_EXPR. (analyze_transpose): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. (analyze_accesses_for_modify_stmt): Likewise. Remove comment about the type being integral type as it is wrong now. (can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (transform_access_sites): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. Correct the type which the artimentic is done in (is now sizetype). Reindent one loop. * tree-data-ref.c (split_constant_offset): Handle POINTER_PLUS_EXPR * tree-affine.c (tree_to_aff_combination): Likewise. * c-typeck.c (build_unary_op): For pointers create the increment as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * gimplify.c (gimplify_self_mod_expr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR. * tree.def (POINTER_PLUS_EXPR): New tree code. * tree-predcom.c (ref_at_iteration): If we have a pointer type do the multiplication in sizetype. * tree-mudflap.c (mf_xform_derefs_1): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Don't expect there to be a cast for the index as that does not exist anymore. (forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR instead of PLUS_EXPR. Don't check for the first operand of the POINTER_PLUS_EXPR was the index as it cannot be. Call forward_propagate_addr_into_variable_array_index with the SSA_NAME instead of the statement. * varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR. (compare_constant): Likewise. (copy_constant): Likewise. (compute_reloc_for_constant): Likewise. (output_addressed_constants): Likewise. (initializer_constant_valid_p): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion_1): Convert the MIN/MAX of the inner type to the outer type before comparing them. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-inline.c (estimate_num_insns_1): Handle POINTER_PLUS_EXPR. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (bump_vector_ptr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for the pointer increment statement. (vect_update_ivs_after_vectorizer): For pointer types, create POINTER_PLUS_EXPR instead of PLUS_EXPR and also create MULT_EXPR in sizetype. (vect_gen_niters_for_prolog_loop): Add a cast when creating byte_misalign. * tree-object-size.c (plus_expr_object_size): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. (check_for_plus_in_loops_1): Likewise. (check_for_plus_in_loops): Likewise. * c-common.c (pointer_int_sum): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-structalias.c (handle_ptr_arith): Handle only POINTER_PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. * tree-cfg.c (verify_expr): Add extra checking for pointers and PLUS_EXPR and MINUS_EXPR. Also add checking to make sure the operands of POINTER_PLUS_EXPR are correct. * config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype with make_tree, instead of a pointer type. * config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR for pointers instead of PLUS_EXPR. (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR instead of PLUS_EXPR when doing addition on pointer types. Use sizetype for the second operand. (spu_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was a pointer. Don't create a BIT_AND_EXPR for pointer types. * config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR for the pointer addition and also use size_int/sizetype for the offset. (ix86_gimplify_va_arg): Likewise. Perform BIT_AND_EXPR on sizetype arguments. * config/sh/sh.c (sh_va_start): Call make_tree with sizetype and convert its result to a pointer type. Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. (sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. Perform BIT_AND_EXPR on sizetype arguments. * config/ia64/ia64.c (ia64_gimplify_va_arg): Use POINTER_PLUS_EXPR for pointers and create the BIT_AND_EXPR in sizetype. * config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. (rs6000_va_start): Likewise. Also use sizetype for the offset. * config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR as PLUS_EXPR/MINUS_EXPR. (hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR. Don't use BIT_AND_EXPR on a pointer type, convert the expression to sizetype first. * config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR for pointers. (mips_gimplify_va_arg_expr): Likewise. Don't create BIT_AND_EXPR in a pointer type. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. * trans-expr.c (gfc_trans_string_copy): Create POINTER_PLUS_EXPR instead of a PLUS_EXPR for pointer types. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * typeck.c (build_binary_op): For templates build the expression in pieces to avoid the assert in build2_stat. (get_member_function_from_ptrfunc): Change over to using POINTER_PLUS_EXPR and convert the second operand to sizetype. * typeck2.c (build_m_component_ref): Likewise. * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * class.c (build_base_path): Likewise. (build_base_path): Likewise. (convert_to_base_statically): Likewise. (fixed_type_or_null): Handle POINTER_PLUS_EXPR. (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * call.c (build_special_member_call): Likewise. * rtti.c (build_headof): Likewise. Use sizetype instead of ptrdiff_type_node. (tinfo_base_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * except.c (expand_start_catch_block): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert PLUS_EXPR on pointer types over to use POINTER_PLUS_EXPR and remove the conversion to the pointer types. * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for adding to a pointer type. Use size_int instead of ssize_int. Convert the index to sizetype before adding it to the pointer. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans.c (Attribute_to_gnu): When subtracting an offset from a pointer, use POINTER_PLUS_EXPR with NEGATE_EXPR instead of MINUS_EXPR. (gnat_to_gnu): Likewise. * utils.c (convert): When converting between thin pointers, use POINTER_PLUS_EXPR and sizetype for the offset. * utils2.c (known_alignment): POINTER_PLUS_EXPR have the same semantics as PLUS_EXPR for alignment. (build_binary_op): Add support for the semantics of POINTER_PLUS_EXPR's operands. When adding an offset to a pointer, use POINTER_PLUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * class.c (make_class_data): Build the index in sizetype. Use POINTER_PLUS_EXPR instead of PLUS_EXPR when adding to a pointer type. (build_symbol_entry): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. * except.c (build_exception_object_ref): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32225 * gcc.c-torture/compile/20070605-1.c: New test. * gcc.c-torture/compile/20070603-1.c: New testcase. * gcc.c-torture/compile/20070603-2.c: New testcase. * gcc.c-torture/compile/20070531-1.c: New test. PR tree-opt/32167 * gcc.c-torture/compile/20070531-2.c: New test. PR tree-opt/32144 * gcc.c-torture/compile/20070529-1.c: New test. PR tree-opt/32145 * gcc.c-torture/compile/20070529-2.c: New test. PR tree-opt/32015 * gcc.c-torture/compile/20070520-1.c: New test. * g++.dg/ext/java-1.C: New test. * gcc.dg/vect/vect-106.c: We are now able to vectorize two loops instead of one. Remove the "can't determine dependence" check. * gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer needed as the cast is gone in the first place. * gcc.dg/max-1.c: Change local variable a to be a global one. * gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't have a cast which is PREd. From-SVN: r125755
* tree-ssa-forwprop.c (forward_propagate_into_cond): Return 2 if we need to ↵Richard Biener2007-06-061-6/+15
| | | | | | | | | | | | schedule cfg_cleanup. 2007-06-06 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (forward_propagate_into_cond): Return 2 if we need to schedule cfg_cleanup. (tree_ssa_forward_propagate_single_use_vars): Do so. From-SVN: r125490
* re PR tree-optimization/32090 (ICE in forwprop with zero sized array)Andrew Pinski2007-05-251-7/+7
| | | | | | | | | | | | | | | | | | 2007-05-25 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32090 * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Remove the lhs argument. Use the type of def_rhs instead of lhs. (forward_propagate_addr_expr_1): Update use of forward_propagate_addr_into_variable_array_index. 2007-05-25 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32090 * g++.dg/opt/array2.C: New testcase. From-SVN: r125087
* cfglayout.c, [...]: Fix comment typos.Kazu Hirata2007-05-251-1/+1
| | | | | | | | | | | * cfglayout.c, cgraphunit.c, config/avr/avr.c, fold-const.c, haifa-sched.c, optabs.h, tree-affine.c, tree-data-ref.c, tree-predcom.c, tree-ssa-alias-warnings.c, tree-ssa-forwprop.c, tree-vect-analyze.c, tree-vrp.c: Fix comment typos. Follow spelling conventions. * doc/cpp.texi, doc/invoke.texi: Fix typos. From-SVN: r125080
* re PR tree-optimization/31982 (Missed forw prop with indirect ref and addr. ↵Richard Guenther2007-05-251-19/+21
| | | | | | | | | | | | | | | | | | (and char types or sizeof(type) == 1)) 2007-05-24 Richard Guenther <rguenther@suse.de> Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-optimization/31982 * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Handle arrays with element size one. * gcc.dg/tree-ssa/forwprop-2.c: New testcase. Co-Authored-By: Andrew Pinski <andrew_pinski@playstation.sony.com> From-SVN: r125058
* re PR tree-optimization/31797 (infinite loop in tree-ssa-pre or ICE)Richard Guenther2007-05-121-2/+9
| | | | | | | | | | | | 2007-05-12 Richard Guenther <rguenther@suse.de> PR tree-optimization/31797 * tree-ssa-forwprop.c (forward_propagate_addr_expr): Do not propagate into a stmt that has volatile ops. * gcc.c-torture/compile/pr31797.c: New testcase. From-SVN: r124637
* re PR tree-optimization/31146 (forwprop does not look through casts)Richard Guenther2007-05-021-4/+17
| | | | | | | | | | | | | | | 2007-05-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/31146 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): New argument, single_use_p. If we have a single use that is a conversion to the definition rhs type, propagate that rhs. (forward_propagate_addr_expr): Pass single_use_p argument to forward_propagate_addr_expr_1. * g++.dg/tree-ssa/pr31146-2.C: New testcase. From-SVN: r124349
* tree-ssa-forwprop.c (forward_propagate_into_cond): Keep track if we ↵Richard Guenther2007-04-271-5/+20
| | | | | | | | | | | | | | simplified anything. 2007-04-27 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (forward_propagate_into_cond): Keep track if we simplified anything. (tree_ssa_forward_propagate_single_use_vars): Defer overflow warnings until we did a simplification and the stmt was not marked as TREE_NO_WARNING. From-SVN: r124242
* tree-ssa-forwprop.c (get_prop_dest_stmt): Fix comment typo.Richard Guenther2007-04-271-1/+1
| | | | | | | | 2007-04-27 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (get_prop_dest_stmt): Fix comment typo. From-SVN: r124218
* re PR tree-optimization/30965 (Fails to tree-combine conditions in COND_EXPRs)Richard Guenther2007-04-271-376/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-04-27 Richard Guenther <rguenther@suse.de> PR tree-optimization/30965 PR tree-optimization/30978 * Makefile.in (tree-ssa-forwprop.o): Depend on $(FLAGS_H). * tree-ssa-forwprop.c (forward_propagate_into_cond_1): Remove. (find_equivalent_equality_comparison): Likewise. (simplify_cond): Likewise. (get_prop_source_stmt): New helper. (get_prop_dest_stmt): Likewise. (can_propagate_from): Likewise. (remove_prop_source_from_use): Likewise. (combine_cond_expr_cond): Likewise. (forward_propagate_comparison): New function. (forward_propagate_into_cond): Rewrite to use fold for tree combining. (tree_ssa_forward_propagate_single_use_vars): Call forward_propagate_comparison to propagate comparisons. * gcc.dg/tree-ssa/pr30978.c: New testcase. * gcc.dg/tree-ssa/bool-3.c: Remove XFAIL, explain why. * gcc.dg/tree-ssa/ssa-fre-4.c: Use char instead of bool * gcc.dg/strict-overflow-5.c: Adjust tree dump scanning. From-SVN: r124217
* re PR tree-optimization/19431 (missed optimization with ifs and deferencing)Richard Guenther2007-04-181-0/+299
| | | | | | | | | | | | | | | | | | | | | | | | | 2007-04-18 Richard Guenther <rguenther@suse.de> PR tree-optimization/19431 PR tree-optimization/21463 * tree-pass.h (pass_phiprop): Declare. * passes.c (init_optimization_passes): New phiprop pass. * tree-ssa-forwprop.c (struct phiprop_d): New structure. (phivn_valid_p): New helper function. (phiprop_insert_phi): Likewise. (propagate_with_phi): Likewise. (tree_ssa_phiprop): New propagator propagating loads through phi nodes if profitable. * gcc.c-torture/execute/20070212-1.c: New testcase. * gcc.c-torture/execute/20070212-2.c: Likewise. * gcc.c-torture/execute/20070212-3.c: Likewise. * gcc.dg/tree-ssa/pr19431.c: Likewise. * gcc.dg/tree-ssa/pr21463.c: Likewise. * g++.dg/tree-ssa/pr21463.C: Likewise. * g++.dg/tree-ssa/pr30738.C: Likewise. From-SVN: r123946
* re PR tree-optimization/31254 (verify_ssa failed: type mismatch between an ↵Andrew Pinski2007-03-191-6/+3
| | | | | | | | | | | | | | | | | | | SSA_NAME and its symbol) 2007-03-19 Andrew Pinski <andrew_pinski@playstation.sony.com> Richard Guenther <rguenther@suse.de> PR tree-optimization/31254 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Use handled_component_p () where appropriate. Continue propagating into the rhs if we propagated into an INDIRECT_REF on the lhs. * gcc.dg/torture/pr31254.c: New testcase. Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r123060
* re PR tree-optimization/31146 (forwprop does not look through casts)Richard Guenther2007-03-161-34/+46
| | | | | | | | | | | | | | | | | | | | 2007-03-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/31146 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Restructure to allow recursion of forward_propagate_addr_expr. (forward_propagate_addr_into_variable_array_index): Likewise. (forward_propagate_addr_expr): Likewise. (tree_ssa_forward_propagate_single_use_vars): Likewise. (forward_propagate_addr_expr_1): Recurse on simple copies instead of propagating into them. Do so for useless conversions as well. (forward_propagate_addr_expr): Clean up unused statements after recursion. * g++.dg/tree-ssa/pr31146.C: New testcase. From-SVN: r122985
* tree-pass.h (TODO_update_smt_usage): Remove.Diego Novillo2007-03-091-25/+4
| | | | | | | | | | * tree-pass.h (TODO_update_smt_usage): Remove. Update all users. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Remove argument SOME. Update all users. From-SVN: r122787
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Return true when ↵Jan Hubicka2007-02-041-0/+1
| | | | | | | | | | | | | something was changed. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Return true when something was changed. (rename_ssa_copies): When something was changed, do TODO_remove_unused_locals. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value): add TODO_remove_unused_locals when instruction was removed. From-SVN: r121571
* tree-vrp.c (finalize_jump_threads): Do not call cleanup_cfg by hand.Jan Hubicka2007-01-181-1/+1
| | | | | | | | | | | | | | | | | | | * tree-vrp.c (finalize_jump_threads): Do not call cleanup_cfg by hand. * tree-tailcall (add_virtual_phis): Likewise. (optimize_tail_call): Return TODOs. (execute_tail_calls): Return TODOs. * tree-ssa-ccp (execute_fold_all_builtins): Do cleanup_cfg via TODO. * tree-cfgcleanup.c (cleanup_tree_cfg_loop): Return if something changed. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value): Cleanup cfg using TODO. * tree-flow.h (cleanup_tree_cfg_loop): Update prototype. * passes.c (execute_function_todo): When cleanup did something, remove unused locals. * tree-cfg.c (pass_build_cfg): Add cleanup_cfg TODO. (make_edges): Don't cleanup_cfg. From-SVN: r120900
* re PR tree-optimization/1046 (gcc less efficient than jdk for recursion with ↵Jan Hubicka2007-01-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -finline-functions) PR tree-optimization/1046 * tree-tailcall.c (suitable_for_tail_call_opt_p): Use TREE_ADDRESSABLE when alias info is not ready. (pass_tail_recursion): Do not require aliasing. * tree-ssa-copyrename.c (pass_rename_ssa_cop): Likewise. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Likewise. * tree-ssa-copy.c (pass_copy_prop): Likewise. * tree-ssa-forwprop.c (pass_forwprop): Likewise. * tree-ssa-dce.c (pass_dce, pass_dce_loop, pass_cd_dce): Likewise. * passes.c (init_optimization_passes): Execute rename_ssa_copies, ccp, forwprop, copy_prop, merge_phi, copy_prop, dce and tail recursion before inlining. * tree-ssa-operands.c (add_virtual_operand, get_indirect_ref_operand): When aliasing is not build, mark statement as volatile. * gcc.dg/tree-ssa/tailrecursion-4.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-1.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-2.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-3.c: Update dump file. * gcc.dg/tree-ssa/pr21658.c: Likewise. * gcc.dg/tree-ssa/pr15349.c: Likewise. * gcc.dg/tree-ssa/pr25501.c: Likewise. * gcc.dg/tree-ssa/vrp11.c: Make more complex so it still test transformation in question. * gcc.dg/tree-ssa/vrp05.c: Likewise. * gcc.dg/tree-ssa/pr20701.c: Likewise. * gcc.dg/always_inline3.c: Likewise. From-SVN: r120681
* Better handling of COND_EXPRs in rhsRoberto Costa2007-01-081-8/+14
| | | | From-SVN: r120581
* tree-ssa-forwprop.c (forward_propagate_into_cond, [...]): Release defs of ↵Jan Hubicka2007-01-081-1/+5
| | | | | | | | | | propagated statement. * tree-ssa-forwprop.c (forward_propagate_into_cond, tree_ssa_forward_propagate_single_use_va): Release defs of propagated statement. From-SVN: r120580
* tree-ssa-operands.h (create_ssa_artificial_load_stmt): Rename from ↵Diego Novillo2006-12-111-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_ssa_artficial_load_stmt. * tree-ssa-operands.h (create_ssa_artificial_load_stmt): Rename from create_ssa_artficial_load_stmt. Update all users. * tree-into-ssa.c (register_new_def): Make static. * tree.c (is_global_var): Handle SSA_NAMEs. * tree.h (SSA_NAME_IS_DEFAULT_DEF): Define. Update all users that used to call gimple_default_def. * tree-ssa-operands.c (push_stmt_changes): New. (pop_stmt_changes): New. Update every pass that modifies statements to bracket modifications with push_stmt_changes/pop_stmt_changes. (discard_stmt_changes): New. * tree-ssa-dom.c (stmts_to_rescan): Change to stack of 'tree *' instead of 'tree'. Update all users. * tree-flow-inline.h (zero_imm_uses_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-dfa.c (dump_variable): Always show the escape mask. (mark_symbols_for_renaming): Rename from mark_new_vars_to_rename. Update all users. Only mark to rename naked symbols in real and virtual operands. From-SVN: r119746
* tree-vrp.c (pass_vrp): Remove PROP_smt_usage.Daniel Berlin2006-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-12-05 Daniel Berlin <dberlin@dberlin.org> * tree-vrp.c (pass_vrp): Remove PROP_smt_usage. * tree-complex.c (pass_lower_complex): Ditto. * tree-ssa-ccp.c (pass_ccp): Ditto. (pass_store_ccp): Ditto. * tree-ssa-dom.c (pass_dominator): Ditto. (pass_phi_only_cprop): Ditto. * tree-sra.c (pass_sra): Ditto. * tree-ssa-forwprop.c (pass_forwprop): Ditto. * tree-flow.h (updating_used_alone): Remove. (updating_used_alone): Ditto. * tree-ssa-alias.c (updating_used_alone): Remove variable. (lhs_may_store_to): Remove function. (recalculate_used_alone): Ditto. (compute_may_aliases): Remove used_alone calculation. * tree.h (struct tree_memory_tag): Remove is_used_alone and old_used_alone. Remove SMT_USED_ALONE and SMT_OLD_USED_ALONE. * tree-pass.h (PROP_smt_usage): Remove. * passes.c (execute_todo): Remove used alone recalculation. (execute_one_pass): Ditto. * tree-ssa-operands.c (add_virtual_operand): Remove used_alone stuff. From-SVN: r119550
* Merge gimple-tuples-branch into mainline.Aldy Hernandez2006-12-051-44/+49
| | | | From-SVN: r119546
* re PR middle-end/29584 (internal compiler error on optimization)Jakub Jelinek2006-11-171-1/+3
| | | | | | | | | | PR middle-end/29584 * tree-ssa-forwprop.c (simplify_switch_expr): Don't optimize if DEF doesn't have integral type. * gcc.dg/torture/pr29584.c: New test. From-SVN: r118921
* re PR tree-optimization/27373 (ICE: add_virtual_operand with pointers to arrays)Daniel Berlin2006-05-171-9/+30
| | | | | | | | | | 2006-05-16 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/27373 * tree-ssa-forwprop.c: (forward_propagate_addr_expr_1): Add argument. (forward_propagate_addr_expr): Update call. From-SVN: r113840
* Implement new immediate use iterators.Andrew MacLeod2006-04-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-04-27 Andrew MacLeod <amacleod@redhat.com> PR tree-optimization/26854 * tree-vrp.c (remove_range_assertions): Use new Immuse iterator. * doc/tree-ssa.texi: Update immuse iterator documentation. * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Use new iterator. * tree-ssa-dom.c (propagate_rhs_into_lhs): Use new iterator. * tree-flow-inline.h (end_safe_imm_use_traverse, end_safe_imm_use_p, first_safe_imm_use, next_safe_imm_use): Remove. (end_imm_use_stmt_p): New. Check for end of immuse stmt traversal. (end_imm_use_stmt_traverse): New. Terminate immuse stmt traversal. (move_use_after_head): New. Helper function to sort immuses in a stmt. (link_use_stmts_after): New. Link all immuses in a stmt consescutively. (first_imm_use_stmt): New. Get first stmt in an immuse list. (next_imm_use_stmt): New. Get next stmt in an immuse list. (first_imm_use_on_stmt): New. Get first immuse on a stmt. (end_imm_use_on_stmt_p): New. Check for end of immuses on a stmt. (next_imm_use_on_stmt): New. Move to next immuse on a stmt. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Use new iterator. * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use new iterator. (perfect_nestify): Use new iterator. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use new iterator. * tree-flow.h (struct immediate_use_iterator_d): Add comments. (next_imm_name): New field in struct immediate_use_iterator_d. (FOR_EACH_IMM_USE_SAFE, BREAK_FROM_SAFE_IMM_USE): Remove. (FOR_EACH_IMM_USE_STMT, BREAK_FROM_IMM_USE_STMT, FOR_EACH_IMM_USE_ON_STMT): New immediate use iterator macros. * tree-cfg.c (replace_uses_by): Use new iterator. * tree-ssa-threadedge.c (lhs_of_dominating_assert): Use new iterator. * tree-ssa-operands.c (correct_use_link): Remove. (finalize_ssa_use_ops): No longer call correct_use_link. From-SVN: r113321
* tree-sra.c (tree_sra): Return todoflags;Daniel Berlin2006-03-041-6/+16
| | | | | | | | | | | | | | | 2006-03-03 Daniel Berlin <dberlin@dberlin.org> * tree-sra.c (tree_sra): Return todoflags; (generate_one_element): Set TODO_update_smt_usage if needed. (pass_sra): Remove TODO_update_smt_usage. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Add some parameter. (tree_ssa_forward_propagate_single_use_vars): Return TODO_update_smt_usage if we need to update SMT usage. (pass_forwprop): Remove TODO_update_smt_usage. From-SVN: r111692
* tree-vrp.c (execute_vrp): Return value.Daniel Berlin2006-03-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
* tree.def (SYMBOL_MEMORY_TAG): Rename from TYPE_MEMORY_TAG.Diego Novillo2006-03-011-2/+2
| | | | | | | | | | | | | | | | | | * tree.def (SYMBOL_MEMORY_TAG): Rename from TYPE_MEMORY_TAG. Update all users. * tree-pass.h (PROP_smt_usage): Rename from PROP_tmt_usage. Update all users. (TODO_update_smt_usage): Rename from TODO_update_tmt_usage. Update all users. * tree.h (SMT_USED_ALONE): Rename from TMT_USED_ALONE. Update all users. * tree-flow.h (struct var_ann_d): Rename field 'type_mem_tag' to 'symbol_mem_tag'. Update all users. * doc/tree-ssa.texi: Update documentation to reflect TMT->SMT rename. From-SVN: r111617
* tree.h (struct tree_memory_tag): Add is_used_alone member.Daniel Berlin2006-02-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 2006-02-20 Daniel Berlin <dberlin@dberlin.org> * tree.h (struct tree_memory_tag): Add is_used_alone member. (TMT_USED_ALONE): New macro. * tree-pass.h (PROP_tmt_usage): New property. (TODO_update_tmt_usage): New todo. * tree-ssa-alias.c (updating_used_alone): New variable. (recalculate_used_alone): New function. (compute_may_aliases): Set updating_used_alone, call recalculate_used_alone. * tree-sra.c (pass_sra): Note that this pass destroys PROP_tmt_usage, and add TODO_update_tmt_usage. * tree-ssa-forwprop.c (pass_forwprop): Ditto. * tree-flow.h (updating_used_alone): Prototype. (recalculate_used_alone): Ditto. * passes.c (execute_todo): Add code to set updating_used_alone, and call recalculate. * tree-ssa-operands.c (add_virtual_operand): Only append bare def for clobber if used alone, and add assert to verify used_alone status. From-SVN: r111300
* re PR tree-optimization/25734 (ice for legal kernel code with -Os)Richard Guenther2006-01-111-2/+1
| | | | | | | | | | | | 2006-01-11 Richard Guenther <rguenther@suse.de> PR tree-optimization/25734 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Do not stop propagation after successful propagation to the LHS. * gcc.dg/tree-ssa/pr25734.c: New testcase. From-SVN: r109598
* tree-ssa-dom.c (simplify_cond_and_lookup_avail_expr): Remove code to ↵Jeff Law2006-01-091-1/+135
| | | | | | | | | | | | | | | | | | propagate the RHS of a cast into COND_EXPR_COND. * tree-ssa-dom.c (simplify_cond_and_lookup_avail_expr): Remove code to propagate the RHS of a cast into COND_EXPR_COND. Remove now unused arguments. Callers updated. (eliminate_redundant_computations): Remove now unused arguments, callers updated. (local_fold): Remove, no longer used. (find_equivalent_equality_comparison): Removed from tree-ssa-dom.c and moved to... * tree-ssa-forwprop.c (find_equivalent_equality_comparison): Here. (simplify_cond): New function. (forward_propagate_into_cond): Call simplify_cond. From-SVN: r109502
* tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to ↵Jeff Law2006-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UPDATE_EH_INFO. * tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last change (stmt -> orig_stmt). * tree-eh.c (verify_eh_throw_stmt_node): New function. (bsi_remove): Add new argument. Remove EH information if requested. (verify_eh_throw_table_statements): New function. (bsi_remove): Add new argument REMOVE_EH_INFO. All callers updated. * tree-optimize.c (execute_free_cfg_annotations): Verify the EH throw statement table after removing annotations. * except.h (verify_eh_throw_table_statements): Prototype. * tree-flow.h (bsi_remove): Update prototype. * tree-vrp.c (remove_range_assertions): Add new argument to bsi_remove call. * tree-ssa-loop-im.c (move_computations_stmt): Likewise. * tree-complex.c (expand_complex_div_wide): Likewise. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise * tree-tailcall.c (eliminate_tailcall): Likewise. * tree-ssa-dse.c (dse_optimize_stmt): Likewise. * tree-ssa-loop-ivopts.c (remove_statement): Likewise. * tree-nrv.c (tree_nrv): Likewise. * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise. * tree-if-conv.c (tree_if_convert_cond_expr): Likewise. (combine_blocks): Likewise. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise. * tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise. (cleanup_control_flow): Likewise. (remove_forwarder_block): Likewise. * tree-ssa-pre.c (remove_dead_inserted_code): Likewise. * tree-sra.c (sra_replace): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise. (forward_propagate_single_use_vars): Likewise. * tree-ssa-dce.c (remove_dead_stmt): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-vect-transform.c (vect_transform_loop): Likewise. * tree-outof-ssa.c (rewrite_trees): Likewise. * tree-cfg.c (make_goto_expr_edges): Likewise. (cleanup_dead_labels): Likewise. (tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise. (bsi_move_before, bsi_move_after): Likewise. (bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise (tree_redirect_edge_and_branch, tree_split_block): Likewise. From-SVN: r109421
* tree-dfa.c (mark_new_vars_to_rename): Create stmt annotation, if necessary.Richard Guenther2006-01-061-3/+1
| | | | | | | | | | | | | 2006-01-06 Richard Guenther <rguenther@suse.de> * tree-dfa.c (mark_new_vars_to_rename): Create stmt annotation, if necessary. * tree-ssa-pre.c (create_expression_by_pieces): Remove redundant calls to update_stmt. * tree-ssa-forwprop.c (tidy_after_forward_propagate_addr): Likewise. From-SVN: r109416
* tree-ssa-dom.c (simplify_switch_and_lookup_avail_expr): Code to simplify ↵Jeff Law2005-12-181-0/+60
| | | | | | | | | | | | SWITCH_EXPR_CODE moved from here to ... * tree-ssa-dom.c (simplify_switch_and_lookup_avail_expr): Code to simplify SWITCH_EXPR_CODE moved from here to ... * tree-ssa-forwprop.c (simplify_switch_expr): Here. (tree-ssa-forward_propagate_single_use_vars): Call simplify_switch_expr when appropriate. From-SVN: r108738
* tree-ssa-dom.c (update_rhs_and_lookup_avail_expr): Kill.Jeff Law2005-12-171-5/+60
| | | | | | | | | | | | | | * tree-ssa-dom.c (update_rhs_and_lookup_avail_expr): Kill. (simplify_rhs_and_lookup_avail_expr): Kill. Remnants moved into tree-ssa-forwprop.c. (eliminate_redundant_computations): Do not call simplify_rhs_and_lookup_avail_expr anymore. * tree-ssa-forwprop.c (simplify_not_neg_expr): New function extracted from remnants of simplify_rhs_and_lookup_avail_expr. (tree_ssa_forward_propagate_single_use_vars): Call simplify_not_neg_expr appropriately. From-SVN: r108711
* tree.c (recompute_tree_invariant_for_addr_expr): Rename from ↵Diego Novillo2005-12-091-1/+1
| | | | | | | | | | recompute_tree_invarant_for_addr_expr. * tree.c (recompute_tree_invariant_for_addr_expr): Rename from recompute_tree_invarant_for_addr_expr. Update uses everywhere. From-SVN: r108316
* tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.Richard Guenther2005-12-021-3/+3
| | | | | | | | | | | | | | | | | | 2005-12-02 Richard Guenther <rguenther@suse.de> * tree-vrp.c (build_assert_expr_for, process_assert_insertions_for, simplify_cond_using_ranges): Use buildN instead of build. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value): Likewise. * tree-sra.c (generate_one_element_ref, generate_copy_inout, generate_element_copy, generate_element_zero, generate_one_element_init): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise. * lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Likewise. From-SVN: r107894
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Fix thinko in last patch.Richard Guenther2005-12-011-1/+1
| | | | | | | | | 2005-12-01 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (forward_propagate_addr_expr): Fix thinko in last patch. From-SVN: r107814
* re PR tree-optimization/22501 ([meta-bug] tramp3d-v4 missed optimizations)Richard Guenther2005-11-301-25/+49
| | | | | | | | | | | | 2005-11-30 Richard Guenther <rguenther@suse.de> PR tree-optimization/22501 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): New function split out from ... (forward_propagate_addr_expr): ... here. Use it to propagate ADDR_EXPRs to all uses. From-SVN: r107737
* Update FSF address.Kelley Cook2005-06-251-2/+2
| | | | From-SVN: r101317
* basic-block.h, [...]: Don't include errors.h and include toplev.h if necessary.Kaveh R. Ghazi2005-06-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * basic-block.h, bb-reorder.c, c-gimplify.c, config/darwin.c, config/rs6000/rs6000-c.c, dominance.c, gimple-low.c, gimplify.c, lambda-code.c, lambda-trans.c, tree-browser.c, tree-cfg.c, tree-chrec.c, tree-data-ref.c, tree-dfa.c, tree-eh.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-linear.c, tree-mudflap.c, tree-nomudflap.c, tree-outof-ssa.c, tree-pretty-print.c, tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-live.c, tree-ssa-operands.c, tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c, tree-ssa-sink.c, tree-ssa-threadupdate.c, tree-ssa-uncprop.c, tree-ssa.c, tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c, vec.c: Don't include errors.h and include toplev.h if necessary. * rtl.c, varray.c: If we're compiling as a GENERATOR_FILE, include errors.h otherwise include toplev.h. * Makefile.in: Update dependencies. ada: * misc.c: Don't include errors.h. fortran: * fortran/trans-decl.c: Don't include errors.h. * fortran/Make-lang.in: Updates dependencies. java: * java/verify-glue.c: Don't include errors.h and include toplev.h. * java/Make-lang.in: Updates dependencies. treelang: * treelang/lex.l, treelang/parse.y: Don't include errors.h and include toplev.h. * treelang/Make-lang.in: Updates dependencies. From-SVN: r100420
* tree-ssa-forwprop.c (forward_propagate_addr_expr): See through ADDR_EXPR in ↵Richard Guenther2005-05-261-3/+7
| | | | | | | | | finding place to propagate into. * tree-ssa-forwprop.c (forward_propagate_addr_expr): See through ADDR_EXPR in finding place to propagate into. From-SVN: r100223
* tree-ssa-dom.c (cprop_into_stmt): Do not call ↵Jeff Law2005-05-231-1/+5
| | | | | | | | | | | | | | | | | | | recompute_tree_invariant_for_addr_expr here. * tree-ssa-dom.c (cprop_into_stmt): Do not call recompute_tree_invariant_for_addr_expr here. (optimize_stmt): Call it here instead and do so if anything at all has changed in the statement and the RHS is an ADDR_EXPR. * tree-ssa-forwprop.c (tidy_after_forward_propagate_addr): If needed, call recompute_tree_invariant_for_addr_expr. * tree-ssa-propagate.c (substitute_and_fold): Call recompute_tree_invariant_for_addr_expr as needed. * gcc.c-torture/compile/pr21638.c: New test. * gcc.c-torture/compile/20050520-1.c: New test. From-SVN: r100092
* cfgexpand.c, [...]: Fix comment typos.Kazu Hirata2005-05-191-1/+1
| | | | | | | | | | | | gcc/ * cfgexpand.c, tree-cfg.c, tree-inline.c, tree-optimize.c, tree-ssa-forwprop.c: Fix comment typos. * doc/invoke.texi: Fix a typo. cp/ * parser.c: Fix comment typos. From-SVN: r99944
* tree-ssa-forwprop.c (cfg_changed): New.Richard Henderson2005-05-181-19/+34
| | | | | | | | | | | * tree-ssa-forwprop.c (cfg_changed): New. (tidy_after_forward_propagate_addr): New. (forward_propagate_addr_expr): Use it, and fold_stmt_inplace. (forward_propagate_addr_into_variable_array_index): Likewise. (tree_ssa_forward_propagate_single_use_vars): Cleanup cfg if edges were removed. From-SVN: r99935
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Do not propagate an ↵Jeff Law2005-05-181-0/+5
| | | | | | | | | | ADDR_EXPR if the definition and use sites are in different... * tree-ssa-forwprop.c (forward_propagate_addr_expr): Do not propagate an ADDR_EXPR if the definition and use sites are in different EH regions. From-SVN: r99906
* Makefile.in (tree-ssa-forwprop.o): Depend on langhooks.h.Jeff Law2005-05-171-10/+294
| | | | | | | | | | | | | | | | | | | * Makefile.in (tree-ssa-forwprop.o): Depend on langhooks.h. * tree-ssa-forwprop.c: Include langhooks.h. (forward_propagate_addr_expr_into_variable_array_index): New. (forward_propagate_addr_expr): New. (tree_ssa_forward_propagate_single_use_vars): Loop over all the statements in the block instead of just the last statement. Call forward_propagate_addr_expr as needed. (pass_forwprop): Update the SSA graph after forward propagation is complete. * g++.dg/tree-ssa/pr18414.C: New test. * gcc.dg/tree-ssa/pr18414.C: New test. * gcc.dg/tree-ssa/pr17141-1.C: New test. * gcc.dg/tree-ssa/pr17141-2.C: New test. From-SVN: r99837
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Remove redundant code.Kazu Hirata2005-05-111-5/+0
| | | | | | | * tree-ssa-forwprop.c (forward_propagate_into_cond_1): Remove redundant code. From-SVN: r99583
* re PR tree-optimization/21031 (Another missed forward propagation opportunity)Kazu Hirata2005-04-151-0/+23
| | | | | | | | | | | | | | gcc/ PR tree-optimization/21031 * tree-ssa-forwprop.c (ssa_name_defined_by_comparison_p): New. (forward_propagate_into_cond_1): Call it. Forward propagate integer-integer casts into COND_EXPRs. testsuite/ PR tree-optimization/21031 * gcc.dg/tree-ssa/pr21031.c: New. From-SVN: r98199
* tree-ssa-forwprop.c (vars, [...]): Remove.Kazu Hirata2005-04-131-334/+216
| | | | | | | | | | | | * tree-ssa-forwprop.c (vars, record_single_argument_cond_exprs, substitute_single_use_vars): Remove. (forward_propagate_into_cond_1, forward_propagate_into_cond): New. (tree_ssa_forward_propagate_single_use_vars): Call forward_propagate_into_cond for each COND_EXPR. From-SVN: r98072