aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2005-11-02re PR middle-end/22429 (-1073741824 <= n && n <= 1073741823 is true where n ↵Andrew Pinski1-1/+7
is 1073741824) PR 22429 * fold-const.c (build_range_check): Use unsigned when signed overflow is undefined also. If etype is subtype, make sure that the subtraction is in the supertype. From-SVN: r106400
2005-10-20re PR c++/24439 (ICE with invert conditional containing throw)Richard Guenther1-3/+12
2005-10-20 Richard Guenther <rguenther@suse.de> PR c++/24439 * fold-const.c (invert_truthvalue): Handle COND_EXPR with void type operands. * g++.dg/tree-ssa/pr24439.C: New testcase. From-SVN: r105678
2005-10-18re PR middle-end/23522 (fold_widened_comparison bug)Alexey Starovoytov1-3/+3
PR middle-end/23522 * fold-const.c (fold_widened_comparison): Do not allow range based constant folding when right operand cannot be unwidened. Co-Authored-By: Ian Lance Taylor <ian@airs.com> From-SVN: r105536
2005-10-07re PR middle-end/24227 (ICE in compare_values, at tree-vrp.c:415)Richard Guenther1-13/+5
2005-10-07 Richard Guenther <rguenther@suse.de> PR middle-end/24227 * fold-const.c (fold_binary): Fix operand types during folding of X op (A, Y). Evaluation order of the side-effects of X and A are frontend-defined, so ensure we honour that even for tcc_comparison class operands; eased by removing duplicate code. * gcc.c-torture/compile/pr24227.c: New testcase. From-SVN: r105096
2005-09-26re PR middle-end/23960 (ICE in compare_values in VRP)Kazu Hirata1-1/+1
gcc/ PR tree-optimization/23960 * fold-const.c (fold_binary): Use op0 and op1 instead of arg0 and arg1 if we are passing them to fold_build2. gcc/testsuite/ PR tree-optimization/23960 * gcc.c-torture/compile/pr23960.c: New. From-SVN: r104634
2005-09-09re PR c++/23624 (ICE: internal compiler error: in invert_truthvalue, at ↵Richard Guenther1-1/+2
fold-const.c:2697) 2005-09-09 Richard Guenther <rguenther@suse.de> PR c++/23624 * fold-const.c (fold_ternary): Check truth_value_p before calling invert_truthvalue. * g++.dg/tree-ssa/pr23624.C: New testcase. From-SVN: r104083
2005-08-29re PR middle-end/22455 (ICE tree check: expected function_decl, have ↵Daniel Berlin1-7/+12
type_decl in fold_checksum_tree, at fold-const.c:10282) 2005-08-28 Daniel Berlin <dberlin@dberlin.org> Fix PR middle-end/22455 * fold-const.c (fold_checksum_tree): Adjust for now-largest tree size. Checksum only the parts of the tree that exist for the tree code. From-SVN: r103586
2005-08-24fold-const.c (ptr_difference_const): Use cst_and_fits_in_hwi instead of ↵Zdenek Dvorak1-2/+2
host_integerp. * fold-const.c (ptr_difference_const): Use cst_and_fits_in_hwi instead of host_integerp. From-SVN: r103436
2005-08-23re PR middle-end/23517 (can't cast between generic vector types and target ↵Paolo Bonzini1-1/+1
supported vector types) 2005-08-23 Paolo Bonzini <bonzini@gnu.org> PR middle-end/23517 * fold-const.c (fold_convert): Use VIEW_CONVERT_EXPR to convert between vectors. * convert.c (convert_to_integer, convert_to_vector): Likewise. * tree-vect-generic.c (tree_vec_extract, expand_vector_operations_1): Likewise. From-SVN: r103406
2005-08-17c-typeck.c (build_function_call): Call fold_buildN_initializer or ↵James A. Morrison1-15/+47
fold_buildN instead of buildN then... 2005-08-16 James A. Morrison <phython@gcc.gnu.org> * c-typeck.c (build_function_call): Call fold_buildN_initializer or fold_buildN instead of buildN then fold_initializer or fold. (build_unary_op): Likewise. (build_binary_op): Likewise. * fold-const.c (fold_initializer): Remove. (fold_build1_initializer): New function. (fold_build2_initializer): New function. (fold_build3_initializer): New function. * tree.h (fold_initializer): Remove. (fold_build1_initializer): New function. (fold_build2_initializer): New function. (fold_build3_initializer): New function. From-SVN: r103201
2005-08-17fold-const.c (optimize_bit_field_compare): Remove extra fold call.James A. Morrison1-9/+9
2005-08-16 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (optimize_bit_field_compare): Remove extra fold call. (try_move_mult_to_index): Call fold_build2 instead of build2. (fold_binary): Don't call fold after calls to try_move_mult_to_index. * tree-ssa-loop-niter.c (inverse): Call int_const_binop instead of fold_binary_to_constant. (infer_loop_bounds_from_undefined): Call fold_build2 instead of fold (build. * tree-data-ref.c (tree_fold_divides_p): Use tree_int_cst_equal to check if A == gcd (A, B). Remove TYPE argument. (analyze_offset) Use fold_build2 instead of fold (build. (create_data_ref): Likewise. (analyze_siv_subscript_cst_affine): Update calls to tree_fold_divides_p. * tree-ssa-ccp.c (widen_bitfield): Call fold_build2 instead of build2 then fold. From-SVN: r103200
2005-08-16* fold-const.c (tree_expr_nonnegative_p): Regroup cases.Volker Reichelt1-31/+20
From-SVN: r103178
2005-08-16* fold-const.c (fold_ternary): Simplify folding of a CALL_EXPR.Volker Reichelt1-7/+1
From-SVN: r103176
2005-08-16re PR middle-end/23369 (build_range_check generates wrong code for funcptr ↵John David Anglin1-0/+9
comparison) PR middle-end/23369 * fold-const.c (build_range_check): Disable optimization for function pointer expressions on targets that require function pointer canonicalization. From-SVN: r103145
2005-08-14fold-const (fold_binary): Call fold_build2 instead of fold (build.James A. Morrison1-4/+3
2005-08-14 James A. Morrison <phython@gcc.gnu.org> * fold-const (fold_binary): Call fold_build2 instead of fold (build. From-SVN: r103089
2005-08-04tree.h (fold_build1): Change to macro and call fold_build1_stat.Andrew Pinski1-7/+10
2005-08-04 Andrew Pinski <pinskia@physics.uc.edu> * tree.h (fold_build1): Change to macro and call fold_build1_stat. (fold_build2): Likewise. (fold_build3): Likewise. (fold_build1_stat): New function prototype. (fold_build2_stat): Likewise. (fold_build3_stat): Likewise. * fold-const.c (fold_build1): Rename to .. (fold_build1_stat): this. Add MEM_STAT_DECL. Pass the mem stats through to build1_stat. (fold_build2): Rename to .. (fold_build2_stat): this. Add MEM_STAT_DECL. Pass the mem stats through to build2_stat. (fold_build3): Rename to .. (fold_build3_stat): this. Add MEM_STAT_DECL. Pass the mem stats through to build3_stat. From-SVN: r102743
2005-08-02fold-const.c (tree_expr_nonnegative_p): frexp(x, &e) is positive if its ↵Richard Guenther1-1/+1
first argument is positive. 2005-08-02 Richard Guenther <rguenther@suse.de> * fold-const.c (tree_expr_nonnegative_p): frexp(x, &e) is positive if its first argument is positive. From-SVN: r102657
2005-08-01dwarf2out.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* dwarf2out.c, fold-const.c, ipa-type-escape.c, loop-invariant.c, predict.c, predict.def, reload1.c, reorg.c, tree-sra.c, config/arm/arm.c, config/crx/crx.c, config/i386/i386.c, config/mips/mips.h, config/rs6000/rs6000.h, config/sh/sh.c, config/stormy16/stormy16.c: Fix comment typos. From-SVN: r102620
2005-07-30fold-const.c (tree_expr_nonnegative_p): Always return true for non-integral ↵James A. Morrison1-1/+1
types. 2005-07-30 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (tree_expr_nonnegative_p): Always return true for non-integral types. From-SVN: r102587
2005-07-26calls.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* calls.c, fold-const.c, ipa-reference.c, ipa-type-escape.c, tree-ssa-reassoc.c, tree-ssa-structalias.c, vec.h, config/crx/crx.c, config/m32c/m32c.c, config/m32c/m32c.h: Fix comment typos. * doc/c-tree.texi, doc/tree-ssa.texi: Fix typos. From-SVN: r102385
2005-07-26re PR tree-optimization/22486 (Upcasts are not folded away)Richard Guenther1-0/+23
2005-07-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/22486 * fold-const.c (fold_unary): Fold away useless component references of the form (T *)&T.x, if the address doesn't change. * gcc.dg/tree-ssa/upcast-1.c: New testcase. From-SVN: r102381
2005-07-22fold-const.c (fold_unary): Don't strip signed nops from ABS_EXPRs.James A. Morrison1-2/+7
2005-07-21 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (fold_unary): Don't strip signed nops from ABS_EXPRs. (tree_expr_nonnegative_p): Return try for TYPE_UNSIGNED. From-SVN: r102269
2005-07-21re PR middle-end/21180 (checking on fold no longer happens in some cases)Andrew Pinski1-13/+125
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/21180 * fold-const.c (fold_build1): Add checksum for the operands. (fold_build2): Likewise. (fold_build3): Likewise. From-SVN: r102244
2005-07-21re PR tree-optimization/19055 (Minor bit optimization with or and xor)Andrew Pinski1-0/+48
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/19055 * gcc.dg/tree-ssa/pr19055.c: New test. * gcc.dg/tree-ssa/pr19055-2.c: New test. 2005-07-21 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/19055 * fold-const.c (fold_binary): Transform "(X | Y) ^ X" to "Y & ~ X". From-SVN: r102243
2005-07-20tree.h (tree_expr_nonzero_p): Export.James A. Morrison1-4/+8
2005-07-20 James A. Morrison <phython@gcc.gnu.org> * tree.h (tree_expr_nonzero_p): Export. * fold-const.c (tree_expr_nonzero_p): Likewise. Return true for CALL_EXPRs that are alloca calls. (fold_binary): Use omit_one_operand when checking EQ_EXPRs or NE_EXPRs against zero. * tree-flow.h (expr_computes_nonzero): Remove. * tree-vrp.c (expr_computes_nonzero): Remove. (vrp_expr_computes_nonzero): Use tree_expr_nonzero_p. (extract_range_from_unary_expr): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Use tree_expr_nonzero_p. From-SVN: r102201
2005-07-20fold-const.c (tree_expr_nonnegative_p): Only return true for ABS_EXPR when ↵James A. Morrison1-4/+8
flag_wrapv is false because of INT_MIN. 2005-07-19 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (tree_expr_nonnegative_p): Only return true for ABS_EXPR when flag_wrapv is false because of INT_MIN. (tree_expr_nonzero_p): Always call tree_expr_nonzero_p on the argument of an ABS_EXPR. (fold_unary): Always fold ABS_EXPR<ABS_EXPR<x>> into ABS_EXPR<x>. From-SVN: r102184
2005-07-20Make CONSTRUCTOR use VEC to store initializers.Giovanni Bajo1-3/+5
* c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-15[multiple changes]Andrew Pinski1-3/+6
2005-07-15 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/22398 * gcc.c-torture/compile/pr22398.c: New test. 2005-07-11 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/22398 * fold-const.c (build_range_check): Convert high/low to etype if we are only comparing against exp. From-SVN: r102067
2005-07-13fold-const.c (fold_binary): When comparing two simple ADDR_EXPR expressions...Jeff Law1-3/+17
* fold-const.c (fold_binary): When comparing two simple ADDR_EXPR expressions, test their _DECL operands for pointer equality rather than using operand_equal_p. * gcc.dg/tree-ssa/pr22321.c: New test. From-SVN: r101974
2005-07-08Makefile.in (TREE_H): Add treestruct.def.Daniel Berlin1-7/+7
2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Makefile.in (TREE_H): Add treestruct.def. (c-decl.o): Add pointer-set.h * c-decl.c (diagnose_mismatched_decls): Don't attempt to look at visibility on regular DECL's. (merge_decls): Fix the copying of decl nodes of various types for the new structures. Don't update RTL, section name, weak status, etc, on DECL's without RTL. (grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone. Don't check volatile on non-variable types. (store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK to check whether we have seen arguments. * c-objc-common.c (c_tree_printer): Reverse order of tests so that flag is checked before field (flag is common, field is not). * dwarf2out.c (decl_ultimate_origin): Only DECL's with TS_DECL_COMMON could have an origin. (add_location_or_const_value_attribute): Don't check section name on non-var/function decls. (dwarf2out_var_location): Reverse order of tests. * emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace with DECL_WRTL_CHECK. * expmed.c (make_tree): rtl is now in decl_with_rtl. * fold-const.c (fold_binary): Don't check weakness on non-var/function decls. (tree_expr_nonzero_p): Ditto. (fold_checksum_tree): Use tree_decl_extra as sizeof buffer. * ggc-page.c (extra_order_size_table): Add sizes for tree_decl_non_common, tree_parm_decl, tree_var_decl, and tree_field_decl. * gimplify.c (gimplify_bind_expr): Only set DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL. * integrate.c (copy_decl_for_inlining): Don't set RTL on decl's without RTL. * langhooks-def.h (LANG_HOOK_INIT_TS): New. * langhooks.h (init_ts). New langhook. * passes.c (rest_of_decl_compilation): Reverse order of tests. * print-tree.c (print_node): Update to only print fields that exist in the structures the passed decl has. * toplev.c (wrapup_global_declarations): Don't reset DECL_DEFER_OUTPUT on DECL's that don't contain it. * tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed. * tree-inline.c (remap_decl): Ditto. * tree-outof-ssa.c (create_temp): Reverse order of tests. * tree-pretty-print.c (print_declaration): Don't print DECL_REGISTER on things that don't contain it. * tree-vrp.c (expr_computes_nonzero): Don't check weakness on non-var/function decls. * tree.c (tree_contains_struct): New structure. (init_priority_for_decl): New hashtable. (tree_int_map): New structure. (tree_int_map_eq): New function. (tree_int_map_marked_p): Ditto. (tree_int_map_hash): Ditto. (tree_map): Move to tree.h. (tree_map_eq): Externalize. (tree_map_hash): Ditto. (tree_map_marked_p): Ditto. (init_ttree): Set up tree_contains_struct and call langhook. (decl_assembler_name): Use DECL_NON_COMMON_CHECK.. (tree_code_size): Update for new structures. (tree_node_structure): Update for new structures. (make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls without the field. (copy_node_stat): Copy init priority. (build_decl_stat): Ditto for visibility. (ts_enum_names): New. (tree_contains_struct_check_failed): New function. (decl_init_priority_lookup): Ditto. (decl_init_priority_insert): Ditto. * treestruct.def: New file. * tree.h (CODE_CONTAINS_STRUCT): New macro. (CONTAINS_STRUCT_CHECK): Ditto. (tree_contains_struct_check_failed): New prototype. (DECL_CHECK): Removed. (DECL_MINIMAL_CHECK): New. (DECL_COMMON_CHECK): Ditto. (DECL_WRTL_CHECK): Ditto. (DECL_NON_COMMON_CHECK): Ditto. (DECL_WITH_VIS_CHECK): Ditto. (VAR_OR_FUNCTION_DECL_P): Ditto (struct tree_decl_minimal): New structure. (struct tree_decl_common): Ditto. (struct tree_decl_with_rtl): Ditto. (struct tree_decl_with_vis): Ditto. (struct tree_decl_non_common): Ditto. (struct tree_field_decl): Ditto. (struct tree_parm_decl): Ditto. (struct tree_var_decl): Ditto. (struct tree_function_decl): Ditto. (struct tree_const_decl): Ditto. (struct tree_result_decl): Ditto. (union tree_node): Add new structures. * var-tracking.c (track_expr_p): Reverse order of tests. * doc/c-tree.texi: Add documentation on DECL node internal structure. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is removed. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Make-lang.in: Add gt-cp-lang.h. (cp-lang.o): Ditto. * class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on the field. * config-lang.in: Add cp-lang.c to gtfiles. * cp-lang.c: Include hashtab.h. (cp_init_ts): New function. (LANG_HOOK_INIT_TS): Use macro. (decl_shadowed_for_var_lookup): New function. (decl_shadowed_for_var_insert): Ditto. * cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common. (NON_THUNK_FUNCTION_CHECK): Ditto. (DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common. (DECL_INIT_PRIORITY): Ditto. (DECL_HAS_SHADOWED_FOR_VAR_P): Ditto. (DECL_SHADOWED_FOR_VAR): Use hashtable. (SET_DECL_SHADOWED_FOR_VAR): Ditto. * decl.c (duplicate_decls): Update for new/updated structures. (poplevel): Use SET_DECL_SHADOWED_FOR_VAR. * decl2.c (start_static_initialization_or_destruction): Deal with priority. * pt.c (tsubst_decl): Check TS_DECL_WRTL before doing SET_DECL_RTL. * tree.c (handle_init_priority_attribute): Handle priority. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is removed. * objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common. (KEYWORD_KEY_NAME): Use decl_minimal. (METHOD_SEL_NAME): Ditto.. (METHOD_SEL_ARGS): Use decl_non_common. (METHOD_ADD_ARGS): Ditto. (METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common. (METHOD_DEFINITION): Ditto. (METHOD_ENCODING): Ditto. * objc-lang.c: (objc_init_ts): New function. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN is removed. From-SVN: r101799
2005-07-02re PR tree-optimization/14490 ([tree-ssa] Simplify "a - 10 > 150" into "a > ↵Andrew Pinski1-2/+26
160") 2005-07-02 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/14490 * fold-const.c (fold_binary): Handle the return value of fold_to_nonsharp_ineq_using_bound if we get back the same operand back. Implement "X +- C1 CMP C2" folding to "X CMP C2 -+ C1". From-SVN: r101535
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101317
2005-06-20fold-const.c (swap_tree_comparison): Add support for unordered floating ↵Roger Sayle1-0/+12
point comparisons. * fold-const.c (swap_tree_comparison): Add support for unordered floating point comparisons. * tree-vrp.c (opposite_comparison): Delete. (extract_range_from_assert): Replace calls to opposite_comparison with calls to swap_tree_comparison. (register_edge_assert_for): Likewise. (vrp_evaluate_conditional): Likewise. From-SVN: r101201
2005-06-18fold_const (fold_binary): Fold X % (2**N) to X & (2**N - 1) for nonnegative ↵James A. Morrison1-5/+5
values of X. 2005-06-18 James A. Morrison <phython@gcc.gnu.org> * fold_const (fold_binary): Fold X % (2**N) to X & (2**N - 1) for nonnegative values of X. From-SVN: r101163
2005-06-16re PR tree-optimization/22035 (complex float comparison broken)Richard Henderson1-356/+0
PR tree-opt/22035 * builtins.c (fold_builtin_complex_mul): Remove. (fold_builtin_complex_div): Remove. (fold_builtin_1): Don't call them. * fold-const.c (fold_complex_add, fold_complex_mult_parts, fold_complex_mult, fold_complex_div_parts, fold_complex_div): Remove. (fold_binary): Don't call them. Don't expand complex comparisons to elementary comparisons. * tree-complex.c (init_dont_simulate_again): Enhance search for stmts that require decomposition. (complex_visit_stmt): Handle RETURN_EXPR properly. (create_components): Handle no referenced variables properly. * tree.h (fold_complex_mult_parts): Remove. (fold_complex_div_parts): Remove. From-SVN: r101086
2005-06-13re PR middle-end/21985 (miscompiled or wrong code snippet?)Zdenek Dvorak1-3/+1
PR middle-end/21985 * fold-const.c (split_address_to_core_and_offset): Always return the address of the base object. * gcc.dg/tree-ssa/pr21985.c: New test. From-SVN: r100877
2005-06-13re PR tree-optimization/14796 ([tree-ssa] combine two shifts into one)James A. Morrison1-8/+7
2005-06-12 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/14796 * fold-const (fold_binary): Transform (X << C) >> C into X & (-1>>C) for unsigned types. From-SVN: r100869
2005-06-12re PR tree-optimization/14796 ([tree-ssa] combine two shifts into one)James A. Morrison1-0/+53
2005-06-12 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/14796 * fold-const.c (fold_binary): Transform (A >> C) << C into one BIT_AND_EXPR. <shift>: Transform (A OP c1) OP c2 into A OP (c1 + c2). From-SVN: r100853
2005-06-06re PR middle-end/21897 (Segementation fault in fold_ternary)Jakub Jelinek1-3/+6
* fold-const.c (operand_equal_p): Don't return 1, if element chains for 2 VECTOR_CSTs are not the same length. PR regression/21897 * fold-const.c (fold_ternary) <case BIT_FIELD_REF>: Don't crash if not all VECTOR_CST elements are given. * gcc.c-torture/execute/20050604-1.c: New test. From-SVN: r100674
2005-06-03re PR middle-end/21858 (ICE in compare_values, at tree-vrp.c:301)Richard Guenther1-4/+8
2005-06-03 Richard Guenther <rguenth@gcc.gnu.org> PR middle-end/21858 * fold-const.c (fold_binary): Fix type mismatches in folding of comparisons. * gcc.dg/pr21858.c: New testcase. From-SVN: r100539
2005-06-01[multiple changes]Diego Novillo1-2/+1
2005-06-01 Diego Novillo <dnovillo@redhat.com> PR 14341, PR 21332, PR 20701, PR 21029, PR 21086, PR 21090 PR 21289, PR 21348, PR 21367, PR 21368, PR 21458. * fold-const.c (invert_tree_comparison): Make extern. * tree-flow.h (enum value_range_type): Move to tree-ssa-propagate. (struct value_range_def): Limewise. (get_value_range): Remove. (dump_value_range): Remove. (dump_all_value_ranges): Remove. (debug_all_value_ranges): Remove. (vrp_evaluate_conditional): Declare. * tree-ssa-propagate.c (struct prop_stats_d): Add field num_pred_folded. (substitute_and_fold): Add argument use_ranges_p. Update all callers. If use_ranges_p is true, call fold_predicate_in to fold predicates using range information. Ignore ASSERT_EXPRs. Change debugging output to only show statements that have been folded. (replace_phi_args_in): Move debugging output code from substitute and fold. (fold_predicate_in): New local function. * tree-ssa-propagate.h (enum value_range_type): Move from tree-flow.h. (struct value_range_d): Likewise. Add field 'equiv'. (value_range_t): Rename from value_range. * tree-vrp.c (found_in_subgraph): Rename from found. (get_opposite_operand): Remove. (struct assert_locus_d): Declare. (assert_locus_t): Declare. (need_assert_for): Declare. (asserts_for): Declare. (blocks_visited): Declare. (vr_value): Declare. (set_value_range): Add argument 'equiv'. Don't drop to VARYING ranges that cover all values in the type. Make deep copy of equivalence set 'equiv'. (copy_value_range): New local function. (set_value_range_to_undefined): New local function. (compare_values): Return -2 if either value has overflowed. (range_includes_zero_p): New local function. (extract_range_from_assert): Flip the predicate code if the name being asserted is on the RHS of the predicate. Avoid creating unnecessary symbolic ranges if the comparison includes another name with a known numeric range. Update the equivalnce set of the new range when asserting EQ_EXPR predicates. (extract_range_from_ssa_name): Update the equivalence set of the new range with VAR. (extract_range_from_binary_expr): Also handle TRUTH_*_EXPR. If -fwrapv is used, set the resulting range to VARYING if the operation overflows. Otherwise, use TYPE_MIN_VALUE and TYPE_MAX_VALUE to represent -INF and +INF. Fix handling of *_DIV_EXPR. (extract_range_from_unary_expr): Handle MINUS_EXPR and ABS_EXPR properly by switching the range around if necessary. (extract_range_from_comparison): New local function. (extract_range_from_expr): Call it. (adjust_range_with_scev): Do not adjust the range if using wrapping arithmetic (-fwrapv). (dump_value_range): Also show equivalence set. Show -INF and +INF for TYPE_MIN_VALUE and TYPE_MAX_VALUE. (build_assert_expr_for): Also build ASSERT_EXPR for EQ_EXPR. (infer_value_range): Change return value to bool. Add arguments 'comp_code_p' and 'val_p'. Do not attempt to infer ranges from statements that may throw. Store the comparison code in comp_code_p. Store the other operand to be used in the predicate in val_p. (dump_asserts_for): New. (debug_asserts_for): New. (dump_all_asserts): New. (debug_all_asserts): New. (register_new_assert_for): New. (register_edge_assert_for): New. (find_conditional_asserts): New. (find_assert_locations): New. (process_assert_insertions_for): New. (process_assert_insertions): New. (insert_range_assertions): Initialize found_in_subgraph, blocks_visited, need_assert_for and asserts_for. Call find_assert_locations and process_assert_insertions. (remove_range_assertions): Add more documentation. (vrp_initialize): Change return type to void. Do not try to guess if running VRP is worth it. (compare_name_with_value): New. (compare_names): New. (vrp_evaluate_conditional): Add argument 'use_equiv_p'. If use_equiv_p is true, call compare_names and compare_name_with_value to compare all the ranges for every name in the equivalence set of the predicate operands. Update all callers. (vrp_meet): Try harder not to derive a VARYING range. If two values meet, the resulting equivalence set is the intersection of the two equivalence sets. (vrp_visit_phi_node): Call copy_value_range to get the current range information of the LHS. (vrp_finalize): Create a value vector representing all the names that ended up with exactly one value in their range. Call substitute_and_fold. (execute_vrp): Document equivalence sets in ranges. * tree.h (SSA_NAME_VALUE_RANGE): Remove. (struct tree_ssa_name): Remove field value_range. (invert_tree_comparison): Declare. testsuite/ChangeLog 2005-06-01 Diego Novillo <dnovillo@redhat.com> PR 14341, PR 21332, PR 20701, PR 21086, PR 21090 PR 21289, PR 21348, PR 21367, PR 21368, PR 21458. * gcc.dg/tree-ssa/pr14341.c: New test. * gcc.dg/tree-ssa/pr14841.c: New test. * gcc.dg/tree-ssa/pr20701.c: New test. * gcc.dg/tree-ssa/pr21086.c: New test. * gcc.dg/tree-ssa/pr21090.c: New test. * gcc.dg/tree-ssa/pr21332.c: New test. * gcc.dg/tree-ssa/pr21458.c: New test. * gcc.dg/tree-ssa/pr21658.c: New test. * gcc.dg/tree-ssa/vrp01.c: New test. * gcc.dg/tree-ssa/vrp02.c: New test. * gcc.dg/tree-ssa/vrp03.c: New test. * gcc.dg/tree-ssa/vrp04.c: New test. * gcc.dg/tree-ssa/vrp05.c: New test. * gcc.dg/tree-ssa/vrp06.c: New test. * gcc.dg/tree-ssa/vrp07.c: New test. * gcc.dg/tree-ssa/vrp08.c: New test. * gcc.dg/tree-ssa/vrp09.c: New test. * gcc.dg/tree-ssa/vrp10.c: New test. * gcc.dg/tree-ssa/vrp11.c: New test. * gcc.dg/tree-ssa/vrp12.c: New test. * gcc.dg/tree-ssa/vrp13.c: New test. 2005-06-01 Alexandre Oliva <aoliva@redhat.com> PR 21029 * gcc.dg/tree-ssa/pr21029.c: New test. From-SVN: r100478
2005-06-01stmt.c (expand_case): Use build_int_cst.Richard Guenther1-2/+5
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org> * stmt.c (expand_case): Use build_int_cst. (node_has_low_bound): Likewise, and correct type mismatch. (node_has_high_bound): Likewise. * fold-const.c (fold_binary): Ensure we build trees with the correct types - undo what STRIP_NOPS possibly did. From-SVN: r100459
2005-06-01tree.h (fold_indirect_ref_1): Export from fold-const.c.Richard Guenther1-1/+1
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org> * tree.h (fold_indirect_ref_1): Export from fold-const.c. * fold-const.c (fold_indirect_ref_1): No longer static. * tree-inline.c (copy_body_r): Use fold_indirect_ref_1 for folding, if possible. From-SVN: r100458
2005-06-01* fold-const.c (fold_ternary): Optimize BIT_FIELD_REF of VECTOR_CST.Jakub Jelinek1-0/+23
From-SVN: r100442
2005-06-01fold-const.c (fold_binary): Fix types in strlen vs.Richard Guenther1-5/+5
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org> * fold-const.c (fold_binary): Fix types in strlen vs. zero comparison folding. From-SVN: r100436
2005-05-31[multiple changes]Andrew Pinski1-2/+9
2005-05-31 Andrew pinski <pinskia@physics.uc.edu> PR middle-end/20931 * g++.dg/opt/pr20931.C: New test. 2005-05-31 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/20931 PR middle-end/20946 * fold-const.c (fold_checksum_tree): Copy types also if TYPE_CONTAINS_PLACEHOLDER_INTERNAL is set. Don't call fold_checksum_tree for TREE_LIST's TREE_CHAIN first. Tail recurse TREE_LIST's TREE_CHAIN. From-SVN: r100397
2005-05-31fold-const.c (extract_array_ref): Handle more cases, do some useful ↵Jeff Law1-12/+35
canonicalization of the base. * fold-const.c (extract_array_ref): Handle more cases, do some useful canonicalization of the base. (fold_binary): Explicitly deal with arrays of zero-sized structures during folding of &a[i] == &a[j]. * gcc.dg/tree-ssa/foldaddr-1.c: New test. From-SVN: r100391
2005-05-27[multiple changes]Richard Guenther1-11/+12
2005-05-18 Richard Guenther <rguenth@gcc.gnu.org> * tree-inline.c (copy_body_r): Manually fold *& to deal with ADDR_EXPRs with mismatched types for now. 2005-05-17 Richard Guenther <rguenth@gcc.gnu.org> * gimplify.c (fold_indirect_ref_rhs): New function. (gimplify_modify_expr_rhs): Use it instead of pessimistic fold_indirect_ref. 2005-05-15 Richard Guenther <rguenth@gcc.gnu.org> * fold-const.c (fold_indirect_ref_1): Add type argument; make sure the resulting expression is of this type. (build_fold_indirect_ref, fold_indirect_ref): Adjust callers. From-SVN: r100267
2005-05-26re PR middle-end/21709 (ICE on compile-time complex NaN)Roger Sayle1-21/+24
PR middle-end/21709 * fold-const.c (const_binop): Check for division by zero during complex division. * gcc.dg/pr21709-1.c: New test case. From-SVN: r100188
2005-05-17Makefile.in: Add tree-ssa-math-opts.c.Paolo Bonzini1-0/+52
gcc: 2005-05-17 Paolo Bonzini <bonzini@gnu.org> * Makefile.in: Add tree-ssa-math-opts.c. * expr.c (expand_expr_real_1) <case RDIV_EXPR>: Never emit as a*(1/b). * fold-const.c (distribute_real_division): New. (fold_binary) <case PLUS_EXPR, case MINUS_EXPR>: Use it. * tree-pass.h (pass_cse_reciprocals): New. * tree-optimize.c (init_tree_optimization_passes): Run it. * tree-ssa-math-opts.c: New file. * doc/passes.texi: Document the new pass. gcc/testsuite: 2005-05-17 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/fold-div-1.c, gcc.dg/recip-1.c, gcc.dg/recip-2.c: New. From-SVN: r99826