aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2011-11-22re PR tree-optimization/51074 (No constant folding performed for ↵Jakub Jelinek1-2/+4
VEC_PERM_EXPR, VEC_INTERLEAVE*EXPR, VEC_EXTRACT*EXPR) PR tree-optimization/51074 * fold-const.c (fold_binary_loc): Fix up VEC_INTERLEAVE_*_EXPR handling for BYTES_BIG_ENDIAN. * optabs.c (can_vec_perm_for_code_p): Likewise. * gcc.dg/vect/pr51074.c: New test. From-SVN: r181627
2011-11-18re PR tree-optimization/51118 (ICE: tree check: expected tree that contains ↵Uros Bizjak1-1/+2
‘typed’ structure, have ‘block’ in fold_checksum_tree, at fold-const.c:14160) PR tree-optimization/51118 * fold-const.c (fold_checksum_tree): Check for TS_TYPED structure before using TREE_TYPE accessor on expr. From-SVN: r181468
2011-11-11re PR tree-optimization/51074 (No constant folding performed for ↵Jakub Jelinek1-0/+164
VEC_PERM_EXPR, VEC_INTERLEAVE*EXPR, VEC_EXTRACT*EXPR) PR tree-optimization/51074 * fold-const.c (vec_cst_ctor_to_array, fold_vec_perm): New functions. (fold_binary_loc): Handle VEC_EXTRACT_EVEN_EXPR, VEC_EXTRACT_ODD_EXPR, VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR with VECTOR_CST or CONSTRUCTOR operands. (fold_ternary_loc): Handle VEC_PERM_EXPR with VECTOR_CST or CONSTRUCTOR operands. * tree-ssa-propagate.c (valid_gimple_rhs_p): Handle ternary expressions. * tree-vect-generic.c (lower_vec_perm): Mask sel_int elements to 0 .. 2 * elements - 1. From-SVN: r181297
2011-10-23re PR tree-optimization/44683 (Optimization bug with copysign builtin)Eric Botcazou1-5/+4
* fold-const.c (invert_tree_comparison): Always invert EQ_EXPR/NE_EXPR. PR tree-optimization/44683 * tree-ssa-dom.c (record_edge_info): Record simple equivalences only if we can be sure that there are no signed zeros involved. From-SVN: r180340
2011-10-21branch-cost1.c: New test.Kai Tietz1-7/+7
* gcc.target/i386/branch-cost1.c: New test. * gcc.target/i386/branch-cost2.c: New test. * gcc.target/i386/branch-cost3.c: New test. * gcc.target/i386/branch-cost4.c: New test. * fold-const.c (simple_operand_p_2): Handle integral casts from boolean-operands. From-SVN: r180295
2011-10-17fold-const.c (simple_operand_p_2): New function.Kai Tietz1-21/+97
* fold-const.c (simple_operand_p_2): New function. (fold_truthop): Rename to (fold_truth_andor_1): function name. Additionally remove branching creation for logical and/or. (fold_truth_andor): Handle branching creation for logical and/or here. From-SVN: r180109
2011-10-10re PR middle-end/50195 (Linking time error with -fast-math -O0)Richard Guenther1-2/+2
2011-10-10 Richard Guenther <rguenther@suse.de> PR middle-end/50195 * fold-const.c (fold_binary_loc): Canonicalize x*x to pow (x, 2) only when optimizing. * gcc.dg/builtins-47.c: Optimize. From-SVN: r179752
2011-10-07re PR other/49752 (Non-existing struct `tree_type' in fold_checksum_tree in ↵Richard Henderson1-5/+1
fold-const.c, can't build with `--enable-checking=fold') PR 49752 * fold-const.c (fold_checksum_tree): Remove out-of-date assert. From-SVN: r179663
2011-10-06fold-const.c (fold_ternary_loc): Also fold non-constant vector CONSTRUCTORs.Richard Guenther1-16/+9
2011-10-06 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_ternary_loc): Also fold non-constant vector CONSTRUCTORs. Make more efficient. * tree-ssa-dom.c (cprop_operand): Don't handle virtual operands. (cprop_into_stmt): Don't propagate into virtual operands. (optimize_stmt): Really dump original statement. From-SVN: r179597
2011-10-04fold-const.c (fold_unary_loc): Don't optimize POINTER_PLUS_EXPR casted to ↵Jakub Jelinek1-0/+1
TYPE_RESTRICT pointer by casting the... * fold-const.c (fold_unary_loc): Don't optimize POINTER_PLUS_EXPR casted to TYPE_RESTRICT pointer by casting the inner pointer if it isn't TYPE_RESTRICT. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't through casts from non-TYPE_RESTRICT pointer to TYPE_RESTRICT pointer. * gcc.dg/tree-ssa/restrict-4.c: New test. From-SVN: r179500
2011-09-30re PR tree-optimization/46309 (optimization a==3||a==1)Jakub Jelinek1-243/+260
PR tree-optimization/46309 * fold-const.c (make_range, merge_ranges): Remove prototypes. (make_range_step): New function. (make_range): Use it. * tree.h (make_range_step): New prototypes. * Makefile.in (tree-ssa-reassoc.o): Depend on $(DIAGNOSTIC_CORE_H). * tree-ssa-reassoc.c: Include diagnostic-core.h. (struct range_entry): New type. (init_range_entry, range_entry_cmp, update_range_test, optimize_range_tests): New functions. (reassociate_bb): Call optimize_range_tests. * gcc.dg/pr46309.c: New test. From-SVN: r179388
2011-09-28re PR middle-end/50460 (__builtin___strcpy_chk/__builtin_object_size don't work)Richard Guenther1-6/+77
2011-09-28 Richard Guenther <rguenther@suse.de> PR middle-end/50460 * fold-const.c (try_move_mult_to_index): Handle &a.array the same as &a.array[0]. From-SVN: r179313
2011-09-05revert: fold-const.c (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE ↵Richard Guenther1-3/+5
special-casing. 2011-09-05 Richard Guenther <rguenther@suse.de> Revert 2011-08-31 Richard Guenther <rguenther@suse.de> * fold-const.c (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing. From-SVN: r178523
2011-08-31fold-const.c (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing.Richard Guenther1-5/+3
2011-08-31 Richard Guenther <rguenther@suse.de> * fold-const.c (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing. From-SVN: r178377
2011-08-2920011-08-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com>Artjoms Sinkarovs1-10/+13
Richard Guenther <rguenther@suse.de> * tree.h (constant_boolean_node): Adjust prototype. * fold-const.c (fold_convert_loc): Move aggregate conversion leeway down. (constant_boolean_node): Make value parameter boolean, add vector type handling. (fold_unary_loc): Use constant_boolean_node. (fold_binary_loc): Preserve types properly when folding COMPLEX_EXPR <__real x, __imag x>. * gimplify.c (gimplify_expr): Handle vector comparison. * tree.def (EQ_EXPR, ...): Document behavior on vector typed comparison. * tree-cfg.c (verify_gimple_comparison): Verify vector typed comparisons. From-SVN: r178209
2011-08-24fold-const.c (fold_comparison): Fold &a < &a + 4 even with -fno-strict-overflow.Richard Guenther1-0/+2
2011-08-24 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_comparison): Fold &a < &a + 4 even with -fno-strict-overflow. From-SVN: r178036
2011-08-18re PR tree-optimization/49963 (ICE: in abs_hwi, at hwint.c:108)Paolo Carlini1-2/+2
2011-08-18 Paolo Carlini <paolo.carlini@oracle.com> Joseph Myers <joseph@codesourcery.com> PR tree-optimization/49963 * hwint.c (absu_hwi): Define. * hwint.h (absu_hwi): Declare. * fold-const.c (fold_plusminus_mult_expr): Use absu_hwi instead of abs_hwi. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise. Co-Authored-By: Joseph Myers <joseph@codesourcery.com> From-SVN: r177848
2011-08-17tree.h (convert_to_ptrofftype_loc): New function.Richard Guenther1-6/+3
2011-08-17 Richard Guenther <rguenther@suse.de> * tree.h (convert_to_ptrofftype_loc): New function. (convert_to_ptrofftype): Define. * builtins.c (expand_builtin_bzero): Use size_type_node. (fold_builtin_bzero): Likewise. (std_gimplify_va_arg_expr): Build the BIT_AND_EXPR on the pointer. * c-typeck.c (build_unary_op): Use convert_to_ptrofftype_loc. * cgraphunit.c (thunk_adjust): Use fold_build_pointer_plus_loc. (cgraph_redirect_edge_call_stmt_to_callee): Use size_int. * expr.c (expand_expr_addr_expr_1): Use fold_build_pointer_plus. * fold-const.c (build_range_check): Negate using the original type. (fold_unary_loc): Use fold_build_pointer_plus_loc. * gimple-fold.c (gimple_adjust_this_by_delta): Use convert_to_ptrofftype. * gimplify.c (gimplify_self_mod_expr): Likewise. * graphite-clast-to-gimple.c (clast_to_gcc_expression): Likewise. (graphite_create_new_loop_guard): Likewise. * graphite-sese-to-poly.c (my_long_long): Remove. (scop_ivs_can_be_represented): Adjust. * tree-cfg.c (verify_gimple_assign_unary): Use ptrofftype_p. * tree-chrec.c (chrec_fold_plus_1): Use fold_build_pointer_plus. * tree-loop-distribution.c (build_size_arg_loc): Use size_type_node. (generate_memset_zero): Simplify. * tree-mudflap.c: Use fold_convert, not convert. * tree-predcom.c (suitable_reference_p): Expand DR_OFFSET in its own type. (determine_offset): Likewise for DR_STEP. (valid_initializer_p): Likewise. * tree-profile.c (prepare_instrumented_value): Convert the pointer to an integer type of same size. * tree-scalar-evolution.c (interpret_rhs_expr): Do not refer to sizetype without need. * tree-ssa-address.c (tree_mem_ref_addr): Likewise. * tree-ssa-loop-ivopts.c (find_bivs): Use convert_to_ptrofftype. * tree-ssa-loop-manip.c (create_iv): Likewise. (determine_exit_conditions): Adjust comment. * tree-ssa-pre.c (create_expression_by_pieces): Use convert_to_ptrofftype. * tree-ssa-structalias.c (get_constraint_for_1): Likewise. * varasm.c (array_size_for_constructor): Compute using double_ints. From-SVN: r177828
2011-08-15re PR tree-optimization/50082 (-Wstrict-overflow mishandles typedef)Richard Guenther1-1/+2
2011-08-15 Richard Guenther <rguenther@suse.de> PR middle-end/50082 * fold-const.c (maybe_canonicalize_comparison_1): Properly convert the modified operand to the other operand type. (fold_comparison): Call maybe_canonicalize_comparison_1 with useless conversions stripped from comparison operands. From-SVN: r177762
2011-08-12builtins.def (BUILT_IN_ICEIL{,F,L}, [...]): New builtin definitions.Uros Bizjak1-0/+4
* builtins.def (BUILT_IN_ICEIL{,F,L}, BUILT_IN_IFLOOR{,F,L} BUILT_IN_IRINT{,F,L}, BUILT_IN_IROUND{,F,L}: New builtin definitions. * convert.c (convert_to_integer): Convert to BUILT_IN_ICEIL, BUILT_IN_IFLOOR, BUILT_IN_IRINT or BUILT_INT_IROUND when converting to integer_type_node. * fold-const.c (tree_call_nonnegative_warnv_p): Handle BUILT_IN_ICEIL, BUILT_IN_IFLOOR, BUILT_IN_IRINT and BUILT_INT_IROUND. * builtins.c (expand_builtin_in): Ditto. (mathfn_built_in_1): Ditto. (expand_builtin_int_roundingfn): Handle BUILT_IN_ICEIL and BUILT_IN_IFLOOR. (expand_builtin_int_roundingfn_2): Handle BUILT_IN_IRINT and BUILT_IN_IROUND. (fold_fixed_mathfn): Canonicalize BUILT_IN_ICEIL, BUILTIN_IN_IFLOOR BUILT_IN_IRINT and BUILT_IN_IROUND to BUILT_IN_LCEIL, BUILTIN_IN_LFLOOR, BUILT_IN_LRINT and BUILT_IN_LROUND on ILP32 targets. testsuite/ChangeLog: * gcc.dg/builtins-67.c: New test. * gcc.target/i386/conversion.c: Ditto. From-SVN: r177694
2011-08-03re PR middle-end/49958 (fold performs invalid association)Richard Guenther1-6/+7
2011-08-03 Richard Guenther <rguenther@suse.de> PR middle-end/49958 * fold-const.c (fold_binary_loc): Only associate (+ (+ (* a b) c) (* d e)) as (+ (+ (* a b) (* d e)) c) if overflow wraps. * gcc.dg/torture/pr49958.c: New testcase. From-SVN: r177270
2011-08-02re PR bootstrap/49914 (call to abs(long long) in gcc/fold-const.c)Paolo Carlini1-3/+2
2011-08-02 Paolo Carlini <paolo.carlini@oracle.com> PR bootstrap/49914 * fold-const.c (fold_plusminus_mult_expr): Use abs_hwi instead of abs. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise. From-SVN: r177212
2011-07-27params.h (ALLOW_STORE_DATA_RACES): New.Aldy Hernandez1-3/+3
* params.h (ALLOW_STORE_DATA_RACES): New. * params.def (PARAM_ALLOW_STORE_DATA_RACES): New. * Makefile.in (expr.o): Depend on PARAMS_H. * machmode.h (get_best_mode): Add argument. * fold-const.c (optimize_bit_field_compare): Add argument to get_best_mode. (fold_truthop): Same. * ifcvt.c (noce_emit_move_insn): Add argument to store_bit_field. * expr.c (emit_group_store): Same. (copy_blkmode_from_reg): Same. (write_complex_part): Same. (optimize_bitfield_assignment_op): Add argument. Add argument to get_best_mode. (get_bit_range): New. (expand_assignment): Calculate maxbits and pass it down accordingly. (store_field): New argument. (expand_expr_real_2): New argument to store_field. Include params.h. * expr.h (store_bit_field): New argument. * stor-layout.c (get_best_mode): Restrict mode expansion by taking into account maxbits. * calls.c (store_unaligned_arguments_into_pseudos): New argument to store_bit_field. * expmed.c (store_bit_field_1): New argument. Use it. (store_bit_field): Same. (store_fixed_bit_field): Same. (store_split_bit_field): Same. (extract_bit_field_1): Pass new argument to get_best_mode. (extract_bit_field): Same. * stmt.c (store_bit_field): Pass new argument to store_bit_field. * doc/invoke.texi: Document parameter allow-store-data-races. From-SVN: r176824
2011-07-21ChangeLog gcc/Kai Tietz1-2/+2
2011-07-21 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_unary_loc): Preserve indirect comparison cast to none-boolean type. * tree-ssa.c (useless_type_conversion_p): Preserve cast from/to boolean-type. * gimplify.c (gimple_boolify): Handle boolification of comparisons. (gimplify_expr): Boolifiy non aggregate-typed comparisons. * tree-cfg.c (verify_gimple_comparison): Check result type of comparison expression. * tree-ssa-forwprop.c (forward_propagate_comparison): Adjust test of condition result and disallow type-cast sinking into comparison. ChangeLog gcc/testsuite 2011-07-21 Kai Tietz <ktietz@redhat.com> * gcc.dg/tree-ssa/pr30978.c: adjusted. * gcc.dg/tree-ssa/ssa-fre-6.c: Likewise. * gcc.dg/binop-xor1.c: Set to fail. * gcc.dg/binop-xor3.c: Set to fail. From-SVN: r176563
2011-07-19tree.h (fold_build_pointer_plus_loc): New helper function.Richard Guenther1-5/+3
2011-07-19 Richard Guenther <rguenther@suse.de> * tree.h (fold_build_pointer_plus_loc): New helper function. (fold_build_pointer_plus_hwi_loc): Likewise. (fold_build_pointer_plus): Define. (fold_build_pointer_plus_hwi): Likewise. * builtins.c (std_gimplify_va_arg_expr): Use fold_build_pointer_plus. (fold_builtin_memory_op): Likewise. (fold_builtin_stpcpy): Likewise. (fold_builtin_memchr): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. * c-typeck.c (build_unary_op): Likewise. * cgraphunit.c (thunk_adjust): Likewise. * fold-const.c (build_range_check): Likewise. (fold_binary_loc): Likewise. * omp-low.c (extract_omp_for_data): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_for_static_chunk): Likewise. * tree-affine.c (add_elt_to_tree): Likewise. * tree-data-ref.c (split_constant_offset_1): Likewise. * tree-loop-distribution.c (generate_memset_zero): Likewise. * tree-mudflap.c (mf_xform_derefs_1): Likewise. * tree-predcom.c (ref_at_iteration): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): Likewise. (add_to_parts): Likewise. (create_mem_ref): Likewise. * tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Likewise. (number_of_iterations_le): Likewise. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Likewise. * tree-vect-data-refs.c (vect_analyze_data_refs): Likewise. (vect_create_addr_base_for_vector_ref): Likewise. * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Likewise. (vect_create_cond_for_alias_checks): Likewise. * tree-vrp.c (extract_range_from_assert): Likewise. * config/alpha/alpha.c (alpha_va_start): Likewise. (alpha_gimplify_va_arg_1): Likewise. * config/i386/i386.c (ix86_va_start): Likewise. (ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mep/mep.c (mep_expand_va_start): Likewise. (mep_gimplify_va_arg_expr): Likewise. * config/mips/mips.c (mips_va_start): Likewise. (mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start): Likewise. (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_va_start): Likewise. (s390_gimplify_va_arg): Likewise. * config/sh/sh.c (sh_va_start): Likewise. (sh_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Likewise. (spu_gimplify_va_arg_expr): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. (xstormy16_gimplify_va_arg_expr): Likewise. * config/xtensa/xtensa.c (xtensa_va_start): Likewise. (xtensa_gimplify_va_arg_expr): Likewise. c-family/ * c-common.c (pointer_int_sum): Use fold_build_pointer_plus. * c-omp.c (c_finish_omp_for): Likewise. cp/ * call.c (build_special_member_call): Use fold_build_pointer_plus. * class.c (build_base_path): Likewise. (convert_to_base_statically): Likewise. (dfs_accumulate_vtbl_inits): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * except.c (expand_start_catch_block): Likewise. * init.c (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * rtti.c (build_headof): Likewise. (tinfo_base_init): Likewise. * typeck.c (get_member_function_from_ptrfunc): Likewise. (cp_build_addr_expr_1): Likewise. * typeck2.c (build_m_component_ref): Likewise. fortran/ * trans-expr.c (fill_with_spaces): Use fold_build_pointer_plus. (gfc_trans_string_copy): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Likewise. * trans-types.c (gfc_get_array_descr_info): Likewise. * trans.c (gfc_build_array_ref): Likewise. java/ * builtins.c (static): Use fold_build_pointer_plus. * class.c (make_class_data): Likewise. (build_symbol_entry): Likewise. * except.c (build_exception_object_ref): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. objc/ * objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Use fold_build_pointer_plus. (objc2_build_ehtype_initializer): Likewise. From-SVN: r176461
2011-07-14fold-const.c (fold_binary_loc): Convert the !bool_var result...Richard Guenther1-4/+6
2011-07-14 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_binary_loc): Convert the !bool_var result, not bool_var when folding bool_var != 1 or bool_var == 0. From-SVN: r176272
2011-07-08fold-const.c (fold_binary_loc): Remove index +p PTR -> PTR +p index folding.Richard Guenther1-7/+0
2011-07-08 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_binary_loc): Remove index +p PTR -> PTR +p index folding. From-SVN: r176044
2011-07-08fold-const.c (fold_truth_andor): Factored out truth_andor label from ↵Kai Tietz1-78/+100
fold_binary as function. 2011-07-08 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_truth_andor): Factored out truth_andor label from fold_binary as function. (fold_binary_loc): Replace truth_andor lable by function fold_truth_andor. From-SVN: r176043
2011-07-07fold-const.c (fold_unary_loc): Do not strip sign-changes for NEGATE_EXPR.Richard Guenther1-1/+1
2011-07-07 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_unary_loc): Do not strip sign-changes for NEGATE_EXPR. * gcc.dg/ftrapv-3.c: New testcase. From-SVN: r175976
2011-06-29re PR middle-end/49545 (New C++ test failures)Richard Sandiford1-2/+1
gcc/ PR tree-optimization/49545 * builtins.c (get_object_alignment_1): Update function comment. Do not use DECL_ALIGN for functions, but test TARGET_PTRMEMFUNC_VBIT_LOCATION instead. * fold-const.c (get_pointer_modulus_and_residue): Don't check for functions here. * tree-ssa-ccp.c (get_value_from_alignment): Likewise. gcc/testsuite/ * gcc.dg/torture/pr49169.c: Restrict to ARM and MIPS targets. From-SVN: r175627
2011-06-27re PR rtl-optimization/49169 (ARM: optimisations strip the Thumb/ARM mode ↵Richard Sandiford1-1/+2
bit off function pointers) gcc/ 2011-07-24 Richard Guenther <rguenther@suse.de> PR tree-optimization/49169 * fold-const.c (get_pointer_modulus_and_residue): Don't rely on the alignment of function decls. gcc/testsuite/ 2011-07-24 Michael Hope <michael.hope@linaro.org> Richard Sandiford <richard.sandiford@linaro.org> PR tree-optimization/49169 * gcc.dg/torture/pr49169.c: New test. From-SVN: r175427
2011-06-20ChangeLog gcc/Kai Tietz1-4/+18
2011-06-20 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_binary_loc): Add missing folding for truth-not operations in combination with binary and. ChangeLog gcc/testsuite/ 2011-06-20 Kai Tietz <ktietz@redhat.com> * gcc.dg/binop-notand1.c: New test. * gcc.dg/binop-notand2.c: New test. * gcc.dg/binop-notand3.c: New test. * gcc.dg/binop-notand4.c: New test. * gcc.dg/binop-notand5.c: New test. * gcc.dg/binop-notand6.c: New test. From-SVN: r175206
2011-06-16gimple.c (canonicalize_cond_expr_cond): (bool)x is not the same as x != 0.Richard Guenther1-8/+0
2011-06-16 Richard Guenther <rguenther@suse.de> * gimple.c (canonicalize_cond_expr_cond): (bool)x is not the same as x != 0. * fold-const.c (fold_binary_loc): Do not fold X & 1 != 0 to (bool) X & 1. * ipa-prop.c (ipa_analyze_indirect_call_uses): Also allow equality compares against zero for the lower bit. From-SVN: r175096
2011-06-10re PR tree-optimization/49361 (Huge 470.lbm regression)Richard Guenther1-1/+2
2011-06-10 Richard Guenther <rguenther@suse.de> PR tree-optimization/49361 * fold-const.c (fold_binary_loc): Only fold x * x to pow (x, 2.0) when not already in gimple form. From-SVN: r174903
2011-05-27re PR middle-end/49189 (infinite recursion in constant folder)Richard Guenther1-7/+11
2011-05-27 Richard Guenther <rguenther@suse.de> PR middle-end/49189 * fold-const.c (fold_unary_loc): Do not re-fold folding conversions of comparisons. * gnat.dg/bit_packed_array5.adb: New testcase. * gnat.dg/bit_packed_array5.ads: Likewise. From-SVN: r174330
2011-05-27re PR middle-end/49177 (FAIL: gcc.dg/vect/fast-math-ifcvt-1.c)Richard Biener1-5/+13
2011-05-27 Richard Guenther <rguenther@suse.de> PR middle-end/49177 * fold-const.c (fold_unary_loc): Fold (T)(A CMP B) to A CMP B ? (T) true : (T) false for non-integral types T again. From-SVN: r174326
2011-05-26fold-const.c (fold_unary_loc): Remove bogus code.Richard Guenther1-15/+0
2011-05-26 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_unary_loc): Remove bogus code. From-SVN: r174290
2011-05-22re PR middle-end/48689 (ICE in fold-const.c:13798 with fold checking)Tom de Vries1-1/+2
2011-05-22 Tom de Vries <tom@codesourcery.com> PR middle-end/48689 * fold-const.c (fold_checksum_tree): Guard TREE_CHAIN use with CODE_CONTAINS_STRUCT (TS_COMMON). From-SVN: r174035
2011-05-09fold-const.c (fold_range_test): Pass LOC to build_range_check.Eric Botcazou1-13/+5
* fold-const.c (fold_range_test): Pass LOC to build_range_check. (fold_ternary_loc): Use expr_location_or. From-SVN: r173588
2011-05-07langhooks.h (lang_hooks_for_types): Change global_bindings_p's return type ↵Eric Botcazou1-19/+6
to bool and adjust comment. 2011-05-07  Eric Botcazou  <ebotcazou@adacore.com> * langhooks.h (lang_hooks_for_types): Change global_bindings_p's return type to bool and adjust comment. * fold-const.c (fold_range_test): Adjust call to global_bindings_p. (fold_mathfn_compare): Remove calls to global_bindings_p. (fold_inf_compare): Likewise. * stor-layout.c (variable_size): Adjust call to global_bindings_p. * c-tree.h (global_bindings_p): Adjust prototype. * c-decl.c (global_bindings_p): Return bool and simplify. ada/ * gcc-interface/gigi.h (global_bindings_p): Adjust prototype. * gcc-interface/utils.c (global_bindings_p): Return bool and simplify. cp/ * name-lookup.h (global_bindings_p): Adjust prototype. * name-lookup.c (global_bindings_p): Return bool. fortran/ * f95-lang.c (global_bindings_p): Return bool and simplify. go/ * go-lang.c (global_bindings_p): Return bool and simplify. java/ * java-tree.h (global_bindings_p): Adjust prototype. * decl.c (global_bindings_p): Return bool. lto/ * lto-lang.c (global_bindings_p): Return bool. From-SVN: r173535
2011-05-04tree.h (int_const_binop): Remove notrunc argument.Richard Guenther1-48/+50
2011-05-04 Richard Guenther <rguenther@suse.de> * tree.h (int_const_binop): Remove notrunc argument. * fold-const.c (int_const_binop): Remove notrunc argument. Always create integer constants that are properly truncated. (extract_muldiv_1): Expand one notrunc int_const_binop caller. (const_binop): Remove zero notrunc argument to int_const_binop. (size_binop_loc): Likewise. (fold_div_compare): Likewise. (maybe_canonicalize_comparison_1): Likewise. (fold_comparison): Likewise. (fold_binary_loc): Likewise. (multiple_of_p): Likewise. * expr.c (store_constructor): Likewise. * gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise. (maybe_fold_stmt_addition): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Likewise. * stor-layout.c (layout_type): Likewise. * tree-data-ref.c (tree_fold_divides_p): Likewise. * tree-sra.c (build_ref_for_offset): Likewise. (build_user_friendly_ref_for_offset): Likewise. * tree-ssa-address.c (maybe_fold_tmr): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise. * tree-ssa-loop-niter.c (inverse): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise. * tree-ssa.c (maybe_rewrite_mem_ref_base): Likewise. * tree-switch-conversion.c (check_range): Likewise. (build_constructors): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vrp.c (set_and_canonicalize_value_range): Likewise. (extract_range_from_assert): Likewise. (vrp_int_const_binop): Likewise. (extract_range_from_binary_expr): Likewise. (extract_range_from_unary_expr): Likewise. (check_array_ref): Likewise. (find_case_label_range): Likewise. (simplify_div_or_mod_using_ranges): Likewise. * tree-cfg.c (group_case_labels_stmt): Use double-ints for comparing case labels for merging. ada/ * gcc-interface/trans.c (gnat_to_gnu): Remove zero notrunc argument to int_const_binop. (pos_to_constructor): Likewise. fortran/ * trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc argument to int_const_binop. From-SVN: r173356
2011-04-29tree-inline.c (remap_eh_region_tree_nr): Use integer_type_node for the ↵Richard Guenther1-2/+4
remapped region number. 2011-04-29 Richard Guenther <rguenther@suse.de> * tree-inline.c (remap_eh_region_tree_nr): Use integer_type_node for the remapped region number. * predict.c (build_predict_expr): Use integer_type_node for the predict kind. * fold-const.c (fold_binary_loc): Use integer_type_node for the shift amount. Use a proper type for the PLUS_EXPR operand. From-SVN: r173156
2011-04-26re PR tree-optimization/48694 (possible memory hog bug)Richard Guenther1-2/+6
2011-04-26 Richard Guenther <rguenther@suse.de> PR middle-end/48694 * tree.h (OEP_CONSTANT_ADDRESS_OF): New operand_equal_flag. * fold-const.c (operand_equal_p): For TREE_CONSTANT ADDR_EXPRs compare the operands with OEP_CONSTANT_ADDRESS_OF. Treat trees with TREE_SIDE_EFFECTS equal when OEP_CONSTANT_ADDRESS_OF is set. * gcc.dg/torture/pr48694-1.c: New testcase. * gcc.dg/torture/pr48694-2.c: Likewise. From-SVN: r172954
2011-04-23re PR c/48685 (ICE in gimplify_expr, at gimplify.c:7034)Jakub Jelinek1-2/+0
PR c/48685 * fold-const.c (fold_convert_loc): Add NOP_EXPR when casting to VOID_TYPE even around MODIFY_EXPR. * gcc.dg/pr48685.c: New test. From-SVN: r172895
2011-04-20ChangeLog gcc/Kai Tietz1-0/+43
2011-04-20 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_binary_loc): Add handling for (X & ~Y) | (~X & Y) and (X && !Y) | (!X && Y) optimization to (X ^ Y). ChangeLog gcc/testsuite 2011-04-20 Kai Tietz <ktietz@redhat.com> * gcc.dg/binio-xor1.c: New test. * gcc.dg/binio-xor2.c: New test. * gcc.dg/binio-xor3.c: New test. * gcc.dg/binio-xor4.c: New test. * gcc.dg/binio-xor5.c: New test. From-SVN: r172776
2011-04-14tree.h (get_object_alignment_1): Declare.Richard Guenther1-27/+7
2011-04-14 Richard Guenther <rguenther@suse.de> * tree.h (get_object_alignment_1): Declare. * builtins.c (get_object_alignment_1): Split out worker from ... (get_object_alignment): ... here. * fold-const.c (get_pointer_modulus_and_residue): Use get_object_alignment_1. * gcc.dg/fold-bitand-4.c: Move ... * c-c++-common/fold-bitand-4.c: ... here. Adjust slightly. From-SVN: r172424
2011-03-30re PR c/48305 (ice at -O0: verify_gimple failed)Jakub Jelinek1-4/+12
PR c/48305 * fold-const.c (fold_binary_loc) <case EQ_EXPR, NE_EXPR>: Make sure arg10/arg11 in (X ^ Y) == (Z ^ W) are always fold converted to matching arg00/arg01 types. * gcc.c-torture/compile/pr48305.c: New test. From-SVN: r171723
2011-03-25fold-const.c (expr_location_or): New function.Nathan Froyd1-42/+23
* fold-const.c (expr_location_or): New function. (fold_truth_not_expr): Call it. From-SVN: r171468
2011-03-24fold-const.c (fold_ternary_loc): Preserve the location (if any) of the ↵Eric Botcazou1-4/+16
argument in calls to fold_truth_not_expr. * fold-const.c (fold_ternary_loc): Preserve the location (if any) of the argument in calls to fold_truth_not_expr. From-SVN: r171403
2011-03-16re PR tree-optimization/48149 (Piecewise complex pass-through not optimized)Richard Guenther1-0/+8
2011-03-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/48149 * fold-const.c (fold_binary_loc): Fold COMPLEX_EXPR <REALPART_EXPR <x>, IMAGPART_EXPR <x>>. * gcc.dg/fold-complex-1.c: New testcase. From-SVN: r171048