aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2005-04-19re PR middle-end/21085 (Virtual memory exhausted with g++)James A. Morrison1-0/+1
2005-04-18 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/21085 * fold-const (fold_binary): Don't change X % -C to X % C if C has overflowed. From-SVN: r98365
2005-04-18re PR tree-optimization/20922 (missed always false conditional)James A. Morrison1-0/+71
2005-04-18 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/20922 * fold-const.c (fold_binary): Fold X - c > X and X + c < X to false. Fold X + c >= X and fold X - c <= X to true. From-SVN: r98321
2005-04-17re PR middle-end/21024 (fold generates a comparison of two operands whose ↵Kazu Hirata1-4/+8
types do not match) PR middle-end/21024 * builtins.c (expand_builtin_strcat): Convert the result of strlen to the right type. * fold-const.c (fold_binary) <PLUS_EXPR>: Use fold_convert to avoid creating type mismatches. <GE_EXPR>: Pass op0 and op1 to fold_build2 to avoid creating type mismatches. From-SVN: r98244
2005-04-16fold-const.c (fold_binary_to_constant): Delete obsolete comment.Roger Sayle1-12/+2
* fold-const.c (fold_binary_to_constant): Delete obsolete comment. (fold_unary_to_constant): Likewise. Co-Authored-By: Steven Bosscher <stevenb@suse.de> From-SVN: r98233
2005-04-16fold-const.c (fold_relational_hi_lo): Delete function and prototype.Roger Sayle1-496/+5
* fold-const.c (fold_relational_hi_lo): Delete function and prototype. (fold_binary): Update comment mentioning fold_relational_hi_lo. (fold_binary_to_constant): Simplify using fold_binary. (fold_unary_to_constant): Likewise, simplify using fold_unary. From-SVN: r98220
2005-04-11fold-const.c (fold_binary_op_with_conditional_arg): use fold_buildN instead ↵Andrew Pinski1-15/+18
of "fold (buildN" in some non obvious places. 2005-04-11 Andrew Pinski <pinskia@physics.uc.edu> * fold-const.c (fold_binary_op_with_conditional_arg): use fold_buildN instead of "fold (buildN" in some non obvious places. (fold_unary): Likewise. (fold_binary): Likewise. From-SVN: r97980
2005-04-11* builtins.def (BUILT_IN_LCEIL, BUILT_IN_LCEILF, BUILT_IN_LCEILL)Uros Bizjak1-0/+2
(BUILT_IN_LLCEIL, BUILT_IN_LLCEILF, BUILT_IN_LLCEILL): New. * optabs.h (enum optab_index): Add new OTI_lceil. (lceil_optab): Define corresponding macro. * optabs.c (init_optabs): Initialize lceil_optab. * genopinit.c (optabs): Implement lceil_optab using lceilsi2 and lceildi2 patterns. * builtins.c (expand_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}. (fold_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}. (fold_builtin_1): Fold BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L} using fold_builtin_int_roundingfn. (mathfn_built_in): Handle BUILT_IN LCEIL and BUILT_IN_LLCEIL. (expand_builtin): Expand BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L} using expand_builtin_int_roundingfn. * convert.c (convert_to_integer): Convert (long int)ceil{,f,l}, into lceil built-in function and (long long int)ceil{,f,l} into llceil built-in function. * fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LCEIL and BUILT_IN_LLCEIL. testsuite: * gcc.dg/builtins-53.c: Also check (int)ceil* and (long long int)ceil*. From-SVN: r97964
2005-04-09* builtins.def (BUILT_IN_LFLOOR, BUILT_IN_LFLOORF, BUILT_IN_LFLOORL)Uros Bizjak1-0/+2
(BUILT_IN_LLFLOOR, BUILT_IN_LLFLOORF, BUILT_IN_LLFLOORL): New. * optabs.h (enum optab_index): Add new OTI_lfloor. (lfloor_optab): Define corresponding macro. * optabs.c (init_optabs): Initialize lfloor_optab. * genopinit.c (optabs): Implement lfloor_optab using lfloorsi2 and lfloordi2 patterns. * builtins.c (expand_builtin_int_roundingfn): New prototype. (expand_builtin_int_roundingfn): New function. (fold_builtin_int_roundingfn): New prototype. (fold_builtin_int_roundingfn): New function, renamed from fold_builtin_lround. Handle BUILT_IN_LROUND{,F,L}, BUILT_IN_LLROUND{,F,L} and BUILT_IN_LFLOOR{,F,L}, BUILT_IN_LLFLOOR{,F,L}. (fold_builtin_1): Fold BUILT_IN_LFLOOR{,F,L} and BUILT_IN_LLFLOOR{,F,L} using fold_builtin_int_roundingfn. (mathfn_built_in): Handle BUILT_IN LFLOOR and BUILT_IN_LLFLOOR. (expand_builtin): Expand BUILT_IN_LFLOOR{,F,L} and BUILT_IN_LLFLOOR{,F,L} using expand_builtin_int_roundingfn. * convert.c (convert_to_integer): Convert (long int)floor{,f,l}, into lfloor built-in function and (long long int)floor{,f,l} into llfloor built-in function. * fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LFLOOR and BUILT_IN_LLFLOOR. testsuite: * gcc.dg/builtins-53.c: New test. From-SVN: r97886
2005-04-08backport: copy-prop, incremental SSA updating of FUD chains and newly ↵Diego Novillo1-0/+15
exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-05i386.md (*truncdfsf2_i387_1): New pattern.Roger Sayle1-1/+0
* config/i386/i386.md (*truncdfsf2_i387_1): New pattern. * fold-const.c (maybe_lvalue_p): Delete orphaned comment. From-SVN: r97594
2005-04-04re PR rtl-optimization/16104 (ICE in reload_cse_simplify_operands, at ↵Jakub Jelinek1-3/+11
postreload.c:378 with SSE2 code on -O2) PR rtl-optimization/16104 * fold-const.c (fold_unary): Fix folding of vector conversions. * gcc.c-torture/execute/20050316-1.c: New test. From-SVN: r97529
2005-04-04re PR c++/19199 (Wrong warning about returning a reference to a temporary)Roger Sayle1-9/+28
2005-04-03 Roger Sayle <roger@eyesopen.com> Alexandre Oliva <aoliva@redhat.com> PR c++/19199 * fold-const.c (non_lvalue): Split tests into... (maybe_lvalue_p): New function. (fold_cond_expr_with_comparison): Preserve lvalue-ness for the C++ front-end prior to lowering into gimple form. * g++.dg/expr/lval2.C: New. * expr2.C: Fixed. From-SVN: r97522
2005-04-01* bb-reorder.c, fold-const.c, varasm.c: Fix comment typos.Kazu Hirata1-3/+3
From-SVN: r97395
2005-03-25re PR tree-optimization/20470 (Branching sequence generated for ABS(x-y))Pat Haugen1-2/+10
2005-03-25 Pat Haugen <pthaugen@us.ibm.com> PR tree-optimization/20470 * fold-const.c (fold_cond_expr_with_comparison): Recognize/fold ABS(x-y). From-SVN: r97062
2005-03-25fold-const.c: Convert uses of fold (build (...)) to fold_buildN.Kazu Hirata1-521/+521
* fold-const.c: Convert uses of fold (build (...)) to fold_buildN. From-SVN: r97046
2005-03-22fold-const.c (fold_build1, [...]): New.Kazu Hirata1-0/+45
* fold-const.c (fold_build1, fold_build2, fold_build3): New. * tree.h: Add corresponding prototypes. From-SVN: r96881
2005-03-22fold-const.c (fold_ternary): Take decomposed arguments of CALL_EXPR.Kazu Hirata1-16/+11
* fold-const.c (fold_ternary): Take decomposed arguments of CALL_EXPR. (fold): Update a call to fold_ternary. From-SVN: r96880
2005-03-22fold-const.c (fold_unary, [...]): Update comments about arguments.Kazu Hirata1-6/+6
* fold-const.c (fold_unary, fold_binary): Update comments about arguments. From-SVN: r96855
2005-03-21builtins.c (fold_builtin): Take decomposed arguments of CALL_EXPR.Kazu Hirata1-1/+3
* builtins.c (fold_builtin): Take decomposed arguments of CALL_EXPR. * fold-const.c (fold_ternary): Update a call to fold_builtin. * gimplify.c (gimplify_call_expr): Likewise. * tree-ssa-ccp.c (ccp_fold, ccp_fold_builtin): Likewise. * tree.h: Update the prototype of fold_builtin. From-SVN: r96800
2005-03-21re PR middle-end/20539 (ICE in simplify_subreg, at simplify-rtx.c:3674)Roger Sayle1-3/+11
PR middle-end/20539 * fold-const.c (fold_binary): Fix type mismatch between TRUTH_{AND,OR,XOR}_EXPR nodes an their operands' types. (fold_binary) <TRUTH_XOR_EXPR>: Avoid calling invert_truthvalue for non-truth-valued expressions. * c-common.c (c_common_truthvalue_conversion): Handle ERROR_MARK and FUNCTION_DECL in the main switch. <TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR, TRUTH_XOR_EXPR>: When changing the result type of these tree nodes, we also need to convert their operands to match. <TRUTH_NOT_EXPR>: Likewise. * gcc.c-torture/compile/pr13066-1.c: New test case. * gcc.c-torture/compile/pr20539-1.c: Likewise. * g++.dg/opt/pr13066-1.C: Likewise. From-SVN: r96777
2005-03-19re PR middle-end/20493 (Bootstrap failure because of aliased symbols)John David Anglin1-0/+18
PR middle-end/20493 * fold-const.c (fold_widened_comparison): Don't optimize casts of function pointers on targets that require function pointer canonicalization. (fold_sign_changed_comparison): Likewise. From-SVN: r96733
2005-03-16re PR tree-optimization/17454 (ICE with --enable-checking=fold)Roger Sayle1-2/+5
PR tree-optimization/17454 * tree.c (tree_size): Add case for TREE_BINFO. * fold-const.c (fold_checksum_tree): Only clear the overloaded field TYPE_CACHED_VALUES if TYPE_CACHED_VALUES_P is set. From-SVN: r96548
2005-03-13re PR middle-end/19331 (Inefficient code generated for bitfield assignment)Roger Sayle1-4/+7
PR middle-end/19331 * tree.c (get_unwidened): Treat CONVERT_EXPR and NOP_EXPR identically. * fold-const.c (fold_sign_changed_comparison): Likewise. (fold_binary): Optimize comparisons against widened operands if the extension is represented by a CONVERT_EXPR, same as a NOP_EXPR. From-SVN: r96397
2005-03-10re PR tree-optimization/15784 (fold misses binary optimization)Jeff Law1-0/+15
PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -A. Fold -A - 1 and -1 - A to ~A. * stmt.c (expand_case): Don't change index_type. Convert minval to the proper type. From-SVN: r96289
2005-03-11re PR tree-optimization/20130 (Fold a * -1 - 1 into ~a;)James A. Morrison1-0/+3
2005-03-11 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/20130 * fold-const.c (fold): Fold x * -1 into -x. From-SVN: r96283
2005-03-09* fold-const.c (fold_unary_to_constant): Add FIX_ROUND_EXPR case.Kaveh R. Ghazi1-0/+1
From-SVN: r96204
2005-03-09fold-const.c (fold_unary, [...]): Take decomposed arguments, code, type, ↵Kazu Hirata1-16/+14
op0, and op1 in case of fold_binary. * fold-const.c (fold_unary, fold_binary): Take decomposed arguments, code, type, op0, and op1 in case of fold_binary. (fold): Update calls to fold_unary and fold_binary. From-SVN: r96202
2005-03-09fold-const.c (fold_unary, [...]): Return NULL_TREE when a given tree is not ↵Kazu Hirata1-33/+37
simplified. * fold-const.c (fold_unary, fold_binary, fold_ternary): Return NULL_TREE when a given tree is not simplified. (fold): Return the original tree when any of the functions mentioned above NULL_TREE. From-SVN: r96201
2005-03-09* fold-const.c (int_const_binop): Remove no_overflow.Kazu Hirata1-2/+0
From-SVN: r96165
2005-03-07fold-const.c (fold_binary_op_with_conditional_arg): Fix typo ordering ops ↵David Edelsohn1-1/+1
from earlier change. * fold-const.c (fold_binary_op_with_conditional_arg): Fix typo ordering ops from earlier change. From-SVN: r96046
2005-03-07fold-const.c (fold_binary): Unroll the very first "for" loop.Kazu Hirata1-17/+41
* fold-const.c (fold_binary): Unroll the very first "for" loop. From-SVN: r96003
2005-03-07* fold-const.c (fold_binary): Remove handling of RANGE_EXPR.Kazu Hirata1-10/+0
From-SVN: r96002
2005-03-06* fold-const.c (fold_unary): Use build1 instead of copy_node.Kazu Hirata1-2/+1
From-SVN: r95989
2005-03-06fold-const.c (fold_binary_op_with_conditional_arg): Take decomposed ↵Kazu Hirata1-10/+11
arguments code, type, op0, and op1 instead of t. * fold-const.c (fold_binary_op_with_conditional_arg): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to fold_range_test. From-SVN: r95978
2005-03-06fold-const.c (fold_range_test): Take decomposed arguments code, type, op0, ↵Kazu Hirata1-17/+16
and op1 instead of t. * fold-const.c (fold_range_test): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to fold_range_test. From-SVN: r95977
2005-03-06fold-const.c (optimize_minmax_comparison): Take decomposed arguments code, ↵Kazu Hirata1-13/+27
type, op0, and op1 instead of t. * fold-const.c (optimize_minmax_comparison): Take decomposed arguments code, type, op0, and op1 instead of t. (fold_binary): Update a call to optimize_minmax_comparison. From-SVN: r95971
2005-03-06* fold-const.c (fold_binary): Use code instead of t.Kazu Hirata1-1/+1
From-SVN: r95970
2005-03-06fold-const.c (fold_binary): Avoid directly using the original expression t ↵Kazu Hirata1-7/+7
as much as possible. * fold-const.c (fold_binary): Avoid directly using the original expression t as much as possible. From-SVN: r95962
2005-03-06* fold-const.c (fold): Remove handling of binary expressions.Kazu Hirata1-2598/+0
From-SVN: r95961
2005-03-05fold-const.c (fold_binary): New.Kazu Hirata1-0/+2617
* fold-const.c (fold_binary): New. (fold): Call fold_binary on binary expressions. From-SVN: r95938
2005-03-04fold-const.c (fold_ternary): Unroll the "for" loop to extract operands.Kazu Hirata1-59/+47
* fold-const.c (fold_ternary): Unroll the "for" loop to extract operands. From-SVN: r95895
2005-03-03revert: re PR tree-optimization/15784 (fold misses binary optimization)Andrew Pinski1-15/+0
2005-03-04 Andrew Pinski <pinskia@physics.uc.edu> Revert for now: 2005-03-03 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -1. Fold -A - 1 and -1 - A to ~A. From-SVN: r95880
2005-03-04fold-const.c (fold_ternary): New.Kazu Hirata1-185/+241
* fold-const.c (fold_ternary): New. (fold): Call fold_ternary on ternary expressions. Remove handling of ternary expressions. From-SVN: r95871
2005-03-04re PR tree-optimization/15784 (fold misses binary optimization)James A. Morrison1-0/+15
2005-03-03 James A. Morrison <phython@gcc.gnu.org> PR tree-optimization/15784 * fold-const.c (fold): Fold ~A + 1 to -1. Fold -A - 1 and -1 - A to ~A. From-SVN: r95870
2005-03-03fold-const.c (fold_unary): Avoid directly using the original expression t as ↵Kazu Hirata1-31/+25
much as possible. * fold-const.c (fold_unary): Avoid directly using the original expression t as much as possible. From-SVN: r95837
2005-03-03* fold-const.c (fold): Remove handling of unary expressions.Kazu Hirata1-398/+2
From-SVN: r95836
2005-03-02fold-const.c (fold_unary): New.Kazu Hirata1-0/+435
* fold-const.c (fold_unary): New. (fold): Call fold_unary on unary expressions. From-SVN: r95783
2005-02-24re PR middle-end/19953 (Special-case real + complex arithmetic operation ↵Richard Henderson1-18/+163
(-ffast-math)) PR middle-end/19953 * builtins.c (fold_builtin_complex_mul, fold_builtin_complex_div): New. (fold_builtin_1): Call them. * fold-const.c (fold_complex_mult_parts): Split out from ... (fold_complex_mult): ... here. Fix typo in both imaginary case. (fold_complex_div_parts, fold_complex_div): New. (fold): Use them. * tree.h (fold_complex_mult_parts, fold_complex_div_parts): Declare. From-SVN: r95511
2005-02-18fold-const.c (constant_boolean_node): Always create values of the specified ↵Roger Sayle1-3/+0
type... * fold-const.c (constant_boolean_node): Always create values of the specified type, don't bother calling truthvalue_conversion. From-SVN: r95237
2005-02-18re PR middle-end/20030 (Broken arguments access)Andrew Pinski1-2/+13
2005-02-18 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/20030 * fold-const.c (fold_indirect_ref_1): Use the correct index for zero access, the lower bound of the array type if it exists. From-SVN: r95226