aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-08re PR middle-end/33693 (Type checking error with bitwise xor/and)Richard Guenther1-6/+8
2007-10-08 Richard Guenther <rguenther@suse.de> PR middle-end/33693 PR middle-end/33695 PR middle-end/33697 * fold-const.c (fold_binary): Use correct types in folding of a * (1 << b) to (a << b). Likewise for ~A & ~B to ~(A | B) and building of RROTATE_EXPR. * gcc.dg/pr33693.c: New testcase. * gcc.dg/pr33695.c: Likewise. * gcc.dg/pr33697.c: Likewise. From-SVN: r129130
2007-10-08re PR middle-end/33691 (Type checking error with bitwise and/or)Richard Guenther1-11/+20
2007-10-08 Richard Guenther <rguenther@suse.de> PR middle-end/33691 PR middle-end/33694 PR middle-end/33696 * fold-const.c (fold_binary): Use the correct types when folding (A | CST1) & CST2 to (A & CST2) | (CST1 & CST2). (fold_binary): Use the correct types when folding (-A) - B to (-B) - A. (fold_unary): Use the correct types when folding ~(X). * gcc.dg/pr33691.c: New testcase. * gcc.dg/pr33694.c: Likewise. * gcc.dg/pr33696.c: Likewise. From-SVN: r129128
2007-10-05re PR middle-end/33666 (Type verification failure with pointer to long long ↵Richard Guenther1-4/+2
conversion) 2007-10-05 Richard Guenther <rguenther@suse.de> PR middle-end/33666 * fold-const.c (fold_unary): Do not fold (long long)(int)ptr to (long long)ptr. * gcc.dg/pr33666.c: New testcase. From-SVN: r129036
2007-09-27re PR tree-optimization/33565 (spurious warning: assuming signed overflow ↵Ian Lance Taylor1-0/+3
does not occur when assuming that (X + c) >= X is always true) ./: PR tree-optimization/33565 * tree-ssa-loop-ch.c (copy_loop_headers): Set TREE_NO_WARNING on assignments of comparisons. * tree-ssa-sccvn.c (simplify_binary_expression): Add stmt parameter. Change caller. Defer overflow warnings around call to fold_binary. * fold-const.c (fold_undefer_overflow_warnings): Don't warn if TREE_NO_WARNING is set on the statement. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Don't test TREE_NO_WARNING when calling fold_undefer_overflow_warnings. * tree-cfg.c (fold_cond_expr_cond): Likewise. testsuite/: PR tree-optimization/33565 * gcc.dg/Wstrict-overflow-20.c: New test. From-SVN: r128840
2007-09-23fold-const.c (fold_binary): Fold BIT_AND_EXPR's with a pointer operand.Ollie Wild1-0/+108
gcc/ fold-const.c (fold_binary): Fold BIT_AND_EXPR's with a pointer operand. (get_pointer_modulus_and_residue): New function. gcc/testsuite/ gcc.dg/fold-bitand-1.c: New test. gcc.dg/fold-bitand-2.c: New test. gcc.dg/fold-bitand-3.c: New test. gcc.dg/fold-bitand-4.c: New test. From-SVN: r128701
2007-09-22re PR tree-optimization/33146 (ICE in build_polynomial_chrec, at ↵Richard Guenther1-2/+4
tree-chrec.h:136) 2007-09-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/33146 * fold-const.c (fold_binary): Use the original tree for negating. * tree.h (STRIP_SIGN_NOPS): Converting from or to pointer also changes "sign". * gcc.c-torture/compile/pr33146.c: New testcase. From-SVN: r128666
2007-09-11fold-const.c (extract_muldiv_1): Do not simplify var * c * c to var.Zdenek Dvorak1-1/+2
* fold-const.c (extract_muldiv_1): Do not simplify var * c * c to var. From-SVN: r128375
2007-09-06re PR tree-optimization/32586 (New VN misses FRE opportunities)Richard Guenther1-2/+2
2007-09-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/32586 * tree-ssa-sccvn.c (simplify_binary_expression): Avoid folding if nothing changed. (simplify_unary_expression): New function. Do tree combining on conversion like codes. (try_to_simplify): Call it. * builtins.c (fold_builtin_cexp): Fold the built expressions. * fold-const.c (fold_unary): Test result of get_callee_fndecl(). * g++.dg/tree-ssa/pr27090.C: Remove XFAILs. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-3.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-5.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-4.c: Likewise, remove scan for now obsolete simplification. From-SVN: r128189
2007-09-05fold-const.c (all_ones_mask_p, [...]): Constify.Kaveh R. Ghazi1-40/+41
* fold-const.c (all_ones_mask_p, sign_bit_p, simple_operand_p, fold_real_zero_addition_p, reorder_operands_p, div_if_zero_remainder, fold_undefer_overflow_warnings, int_binop_types_match_p, fold_convert_const_int_from_int, fold_convert_const_int_from_real, fold_convert_const_int_from_fixed, fold_convert_const_real_from_real, fold_convert_const_real_from_fixed, fold_convert_const_fixed_from_fixed, fold_convert_const_fixed_from_int, fold_convert_const_fixed_from_real, maybe_lvalue_p, fold_checksum_tree, fold_check_failed, print_fold_checksum, debug_fold_checksum, multiple_of_p): Constify. * tree-flow-inline.h (get_lineno): Likewise. * tree-flow.h (get_lineno): Likewise. * tree-object-size.c (compute_object_offset, addr_object_size, alloc_object_size, pass_through_call): Likewise. * tree-pretty-print.c (op_symbol, print_call_name, print_struct_decl, do_niy): Likewise. * tree.h (fold_undefer_overflow_warnings, multiple_of_p, debug_fold_checksum): Likewise. From-SVN: r128120
2007-09-04Add new fp flags: -fassociative-math and -freciprocal-mathRevital Eres1-20/+29
Co-Authored-By: R. Clint Whaley <whaley@cs.utsa.edu> Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r128075
2007-09-01arm.c, [...]: Fix comment typos.Kazu Hirata1-2/+2
* config/arm/arm.c, config/rs6000/ppu_intrinsics.h, config/spu/spu.c, df-scan.c, fixed-value.c, fold-const.c, ginclude/tgmath.h, haifa-sched.c, optabs.c, recog.c, sched-deps.c, sched-int.h, system.h, target.h, tree-ssa-live.c, tree-vect-transform.c, tree-vectorizer.c, tree.def: Fix comment typos. From-SVN: r128016
2007-08-22fixed -ffinite-math-only A-A missing optimisationChristian Bruel1-4/+1
Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r127705
2007-08-21re PR middle-end/32912 (ICE with vector code)Jakub Jelinek1-4/+31
PR middle-end/32912 * fold-const.c (fold_unary): Optimize BIT_NOT_EXPR of VECTOR_CST. (fold_binary): Handle vectors in X | ~X and X ^ ~X optimizations. * gcc.dg/pr32912-1.c: New test. * gcc.dg/pr32912-2.c: New test. * gcc.dg/pr32912-3.c: New test. From-SVN: r127661
2007-08-21fold-const.c (fold_binary): Revert removing of index +p PTRRichard Guenther1-0/+7
2007-08-21 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_binary): Revert removing of index +p PTR * folding. * gcc.dg/pointer-arith-10.c: New testcase. From-SVN: r127660
2007-08-21re PR middle-end/33122 (Mistaken type mismatch error prevents bootstrap)Richard Guenther1-8/+6
2007-08-21 Richard Guenther <rguenther@suse.de> PR middle-end/33122 * fold-const.c (fold_binary): Remove index +p PTR folding. Fix types of POINTER_PLUS_EXPR generated by folding of (PTR +p B) +p A. * gcc.c-torture/compile/pr33122.c: New testcase. From-SVN: r127659
2007-08-09re PR middle-end/32813 (ICE for array expression in empty if statement, ↵Andrew Pinski1-0/+10
compiled with -fbounds-check) 2007-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32813 * fold-const.c (omit_one_operand): Return only the ommitted expression if the result is an empty statement. (pedantic_omit_one_operand): Likewise. 2007-08-09 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32813 * gfortran.fortran-torture/compile/emptyif-1.f90: New test. * lib/fortran-torture.exp (fortran-torture): Use TORTURE_OPTIONS instead of just -O. From-SVN: r127322
2007-08-08tree.def (FIXED_POINT_TYPE): New type.Chao-ying Fu1-12/+334
* tree.def (FIXED_POINT_TYPE): New type. (FIXED_CST): New constant. (FIXED_CONVERT_EXPR): New expr. * doc/c-tree.texi (Types): Document FIXED_POINT_TYPE. (Expressions): Document FIXED_CST and FIXED_CONVERT_EXPR. * tree.h (struct tree_base): Add saturating_flag. Remove one bit of spare for saturating_flag. (NUMERICAL_TYPE_CHECK): Support FIXED_POINT_TYPE. (NON_SAT_FIXED_POINT_TYPE_P, SAT_FIXED_POINT_TYPE_P, FIXED_POINT_TYPE_P): Define. (TYPE_SATURATING): Define. (TREE_FIXED_CST_PTR, TREE_FIXED_CST): Define. (struct tree_fixed_cst): New. (TYPE_IBIT, TYPE_FBIT): Define. (tree_node): Add fixed_cst. (enum tree_index): Add new enumeration values of TI_SAT_SFRACT_TYPE, TI_SAT_FRACT_TYPE, TI_SAT_LFRACT_TYPE, TI_SAT_LLFRACT_TYPE, TI_SAT_USFRACT_TYPE, TI_SAT_UFRACT_TYPE, TI_SAT_ULFRACT_TYPE, TI_SAT_ULLFRACT_TYPE, TI_SFRACT_TYPE, TI_FRACT_TYPE, TI_LFRACT_TYPE, TI_LLFRACT_TYPE, TI_USFRACT_TYPE, TI_UFRACT_TYPE, TI_ULFRACT_TYPE, TI_ULLFRACT_TYPE, TI_SAT_SACCUM_TYPE, TI_SAT_ACCUM_TYPE, TI_SAT_LACCUM_TYPE, TI_SAT_LLACCUM_TYPE, TI_SAT_USACCUM_TYPE, TI_SAT_UACCUM_TYPE, TI_SAT_ULACCUM_TYPE, TI_SAT_ULLACCUM_TYPE, TI_SACCUM_TYPE, TI_ACCUM_TYPE, TI_LACCUM_TYPE, TI_LLACCUM_TYPE, TI_USACCUM_TYPE, TI_UACCUM_TYPE, TI_ULACCUM_TYPE, TI_ULLACCUM_TYPE, TI_QQ_TYPE, TI_HQ_TYPE,_TYPE, TI_SQ_TYPE, TI_DQ_TYPE, TI_TQ_TYPE, TI_UQQ_TYPE, TI_UHQ_TYPE, TI_USQ_TYPE, TI_UDQ_TYPE, TI_UTQ_TYPE, TI_SAT_QQ_TYPE, TI_SAT_HQ_TYPE, TI_SAT_SQ_TYPE, TI_SAT_DQ_TYPE, TI_SAT_TQ_TYPE, TI_SAT_UQQ_TYPE, TI_SAT_UHQ_TYPE, TI_SAT_USQ_TYPE, TI_SAT_UDQ_TYPE, TI_SAT_UTQ_TYPE, TI_HA_TYPE, TI_SA_TYPE, TI_DA_TYPE, TI_TA_TYPE, TI_UHA_TYPE, TI_USA_TYPE, TI_UDA_TYPE, TI_UTA_TYPE, TI_SAT_HA_TYPE, TI_SAT_SA_TYPE, TI_SAT_DA_TYPE, TI_SAT_TA_TYPE, TI_SAT_UHA_TYPE, TI_SAT_USA_TYPE, TI_SAT_UDA_TYPE, TI_SAT_UTA_TYPE. (sat_short_fract_type_node, sat_fract_type_node, sat_long_fract_type_node, sat_long_long_fract_type_node, sat_unsigned_short_fract_type_node, sat_unsigned_fract_type_node, sat_unsigned_long_fract_type_node, sat_unsigned_long_long_fract_type_node, short_fract_type_node, fract_type_node, long_fract_type_node, long_long_fract_type_node, unsigned_short_fract_type_node, unsigned_fract_type_node, unsigned_long_fract_type_node, unsigned_long_long_fract_type_node, sat_short_accum_type_node, sat_accum_type_node, sat_long_accum_type_node, sat_long_long_accum_type_node, sat_unsigned_short_accum_type_node, sat_unsigned_accum_type_node, sat_unsigned_long_accum_type_node, sat_unsigned_long_long_accum_type_node, short_accum_type_node, accum_type_node, long_accum_type_node, long_long_accum_type_node, unsigned_short_accum_type_node, unsigned_accum_type_node, unsigned_long_accum_type_node, unsigned_long_long_accum_type_node, qq_type_node, hq_type_node, sq_type_node, dq_type_node, tq_type_node, uqq_type_node, uhq_type_node, usq_type_node, udq_type_node, utq_type_node, sat_qq_type_node, sat_hq_type_node, sat_sq_type_node, sat_dq_type_node, sat_tq_type_node, sat_uqq_type_node, sat_uhq_type_node, sat_usq_type_node, sat_udq_type_node, sat_utq_type_node, ha_type_node, sa_type_node, da_type_node, ta_type_node, uha_type_node, usa_type_node, uda_type_node, uta_type_node, sat_ha_type_node, sat_sa_type_node, sat_da_type_node, sat_ta_type_node, sat_uha_type_node, sat_usa_type_node, sat_uda_type_node, sat_uta_type_node): New macro. (make_fract_type, make_accum_type): Declare. (make_signed_fract_type, make_unsigned_fract_type, make_sat_signed_fract_type, make_sat_unsigned_fract_type, make_signed_accum_type, make_unsigned_accum_type, make_sat_signed_accum_type, make_sat_unsigned_accum_type, make_or_reuse_signed_fract_type, make_or_reuse_unsigned_fract_type, make_or_reuse_sat_signed_fract_type, make_or_reuse_sat_unsigned_fract_type, make_or_reuse_signed_accum_type, make_or_reuse_unsigned_accum_type, make_or_reuse_sat_signed_accum_type, make_or_reuse_sat_unsigned_accum_type): New macro. (fixed_zerop): Declare. * defaults.h (SHORT_FRACT_TYPE_SIZE, FRACT_TYPE_SIZE, LONG_FRACT_TYPE_SIZE, LONG_LONG_FRACT_TYPE_SIZE, SHORT_ACCUM_TYPE_SIZE, ACCUM_TYPE_SIZE, LONG_ACCUM_TYPE_SIZE, LONG_LONG_ACCUM_TYPE_SIZE): Define. * treestruct.def: Add TS_FIXED_CST. * Makefile.in (c-pretty-print.o): Add dependence on fixed-value.h. (tree.o): Likewise. (tree-dump.o): Likewise. (print-tree.o): Likewise. (tree-pretty-print.o): Likewise. (fold-const.o): Likewise. * tree-complex.c (some_nonzerop): Handle FIXED_CST. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle FIXED_CST. (is_gimple_min_invariant): Handle FIXED_CST. * stor-layout.c (int_mode_for_mode): Handle MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM. (layout_type): Handle FIXED_POINT_TYPE. (make_fract_type, make_accum_type): New functions. * tree-browser.c (browse_tree): Handle FIXED_POINT_TYPE. * tree-dump.c (fixed-value.h): New include. (dump_fixed): New function. (dequeue_and_dump): Handle FIXED_POINT_TYPE and FIXED_CST. * tree-inline.c (remap_type_1): Handle FIXED_POINT_TYPE. (estimate_num_insns_1): Handle FIXED_CST and FIXED_CONVERT_EXPR. * tree-pretty-print.c (fixed-value.h): New include. (dump_generic_node): Handle FIXED_POINT_TYPE, FIXED_CST, and FIXED_CONVERT_EXPR. * tree-scalar-evolution.c (get_scalar_evolution): Handle FIXED_CST. * tree-ssa-loop-im.c (for_each_index): Handle FIXED_CST. * tree-ssa-pre.c (poolify_tree): Handle FIXED_CST. * tree-ssa-reassoc.c (break_up_subtract_bb): We can do reassociation for non-saturating fixed-point types. (reassociate_bb): Likewise. * emit-rtl.c (fixed-value.h): New include. (fconst0, fconst1): New array. (init_emit_once): Initialize fconst0 and fconst1 for fixed-point modes. * tree-vect-generic.c expand_vector_operation): Support MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, and MODE_VECTOR_UACCUM. (type_for_widest_vector_mode): Add one parameter for the saturating flag. Check scalar FRACT, UFRACT, ACCUM, and UACCUM mode to select their vector mode. Pass the satp parameter to type_for_mode for fixed-point types. (expand_vector_operations_1): Pass the saturating flag to type_for_widest_vector_mode. Support MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, and MODE_VECTOR_UACCUM. * tree-vect-transform.c (vect_is_simple_cond): Support FIXED_CST. (vectorizable_condition): Likewise. * tree.c (fixed-value.h): New include. (tree_code_size): Support FIXED_CST. (build_fixed): New function. (build_one_cst): Support FIXED_POINT_TYPE for accum types. (fixed_zerop): New function. (tree_node_structure): Support FIXED_CST. (type_contains_placeholder_1): Support FIXED_POINT_TYPE. (build_type_attribute_qual_variant): Handle FIXED_POINT_TYPE. (type_hash_eq): Handle FIXED_POINT_TYPE. (simple_cst_equal): Support FIXED_CST. (iterative_hash_expr): Handle FIXED_CST. (get_unwidened): Make sure type is not FIXED_POINT_TYPE. (get_narrower): Likewise. (variably_modified_type_p): Handle FIXED_POINT_TYPE. (make_or_reuse_fract_type, make_or_reuse_accum_type): New functions. (build_common_tree_nodes_2): Use MAKE_FIXED_TYPE_NODE_FAMILY and MAKE_FIXED_MODE_NODE macros to initialize fixed-point type nodes. (build_vector_type_for_mode): Handle MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM. (initializer_zerop): Support FIXED_CST. (walk_tree): Handle FIXED_CST and FIXED_POINT_TYPE. * dwarf2out.c (base_type_die): Use DW_ATE_signed_fixed or DW_ATE_unsigned_fixed to describe FIXED_POINT_TYPE. (is_base_type): Handle FIXED_POINT_TYPE. (add_type_attribute): Handle FIXED_POINT_TYPE. (gen_type_die_with_usage): Handle FIXED_POINT_TYPE. * print-tree.c (fixed-value.h): New include. (print_node_brief): Support FIXED_CST. (print_node): Support FIXED_POINT_TYPE and FIXED_CST. * c-pretty-print.c (fixed-value.h): New include. (pp_c_type_specifier): Handle FIXED_POINT_TYPE. Need to pass TYPE_SATURATING to c_common_type_for_mode for fixed-point modes. (pp_c_direct_abstract_declarator): Handle FIXED_POINT_TYPE. Support fixed-point types for inner items in VECTOR_TYPE. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_fixed_constant): New function. (pp_c_constant): Handle FIXED_CST. (pp_c_primary_expression): Likewise. (pp_c_expression): Likewise. * fold-const.c (fixed-value.h): New include. (negate_expr_p): Return true for FIXED_CST. (fold_negate_expr): Support FIXED_CST. (split_tree): Support FIXED_CST. (const_binop): Support FIXED_CST. (fold_convert_const_int_from_fixed): New function to convert from fixed to int. (fold_convert_const_real_from_fixed): New function to convert from fixed to real. (fold_convert_const_fixed_from_fixed): New function to convert from fixed to another fixed. (fold_convert_const_fixed_from_int): New function to convert from int to fixed. (fold_convert_const_fixed_from_real): New function to convert from real to fixed. (fold_convert_const): Support conversions from fixed to int, from fixed to real, from fixed to fixed, from int to fixed, and from real to fixed. (fold_convert): Support FIXED_CST and FIXED_POINT_TYPE. (operand_equal_p): Support FIXED_CST. (make_range): For fixed-point modes, we need to pass the saturating flag as the 2nd parameter. (tree_swap_operands_p): Handle FIXED_CST. (fold_plusminus_mult_expr): For fract modes, we cannot generate constant 1. (fold_unary): Support FIXED_CONVERT_EXPR. (fold_binary): Handle FIXED_CST. Make sure the type is not saturating, before associating operations. Ex: A + B + C, A * B * C, (A1 * C1) +/- (A2 * C2). (tree_expr_nonnegative_warnv_p): Handle FIXED_CST. (fold_negate_const): Support FIXED_CST. (fold_relational_const): Support FIXED_CST. * gimplify.c (omp_firstprivatize_type_sizes): Handle FIXED_POINT_TYPE. (gimplify_expr): Handle FIXED_CST. (gimplify_type_sizes): Handle FIXED_POINT_TYPE. * ipa-prop.c (ipa_callsite_compute_param): Support FIXED_CST. * ipa-type-escape.c (type_to_consider): Handle FIXED_POINT_TYPE. * doc/tm.texi (Type Layout): Document SHORT_FRACT_TYPE_SIZE, FRACT_TYPE_SIZE, LONG_FRACT_TYPE_SIZE, LONG_LONG_FRACT_TYPE_SIZE, SHORT_ACCUM_TYPE_SIZE, ACCUM_TYPE_SIZE, LONG_ACCUM_TYPE_SIZE, LONG_LONG_ACCUM_TYPE_SIZE. * dbxout.c (dbxout_type): Handle FIXED_POINT_TYPE. * c-aux-info.c (gen_type): Handle FIXED_POINT_TYPE. * tree-sra.c (is_sra_scalar_type): Support FIXED_POINT_TYPE. * expmed.c (extract_bit_field): Support MODE_FRACT, MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM. * tree-vectorizer.c (vect_is_simple_reduction): Check for saturating fixed-point types to disable reduction. * explow.c (promote_mode): Support FIXED_POINT_TYPE. From-SVN: r127306
2007-08-03re PR middle-end/32780 (ICE in extract_range_from_binary_expr, at ↵Andrew Pinski1-8/+12
tree-vrp.c:1793 at -O2 or higher) 2007-08-04 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32780 * fold-const.c (fold_binary <case MINUS_EXPR>): Fix the type of operands for the folding of "A - (A & B)" into "~B & A"; cast them to type. 2007-08-04 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32780 * gcc.c-torture/compile/pr32780.c: New test. From-SVN: r127199
2007-08-03re PR middle-end/32935 (internal compiler error: in emit_move_insn, at ↵Andrew Pinski1-1/+1
expr.c:3316) 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32935 * fold-convert.c (fold_negate_expr <NOP_EXPR>): Convert back to the correct type the negate expression. 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32935 * gfortran.fortran-torture/compile/complex_1.f90: New test. From-SVN: r127190
2007-07-29attribs.c (hash_attr, [...]): Constify.Kaveh R. Ghazi1-21/+21
* attribs.c (hash_attr, eq_attr, init_attributes): Constify. * builtins.c (validate_arg, builtin_mathfn_code, validate_arglist): Likewise. * calls.c (call_expr_flags): Likewise. * combine.c (reg_nonzero_bits_for_combine, reg_num_sign_bit_copies_for_combine, get_last_value, reg_truncated_to_mode): Likewise. * emit-rtl.c (subreg_lowpart_p): Likewise. * expr.c (highest_pow2_factor_for_target, categorize_ctor_elements_1, categorize_ctor_elements, count_type_elements, contains_packed_reference, highest_pow2_factor, highest_pow2_factor_for_target): Likewise. * fold-const.c (may_negate_without_overflow_p, int_const_binop, fold_convertible_p, operand_equal_p, tree_swap_operands_p, native_encode_int, native_encode_real, native_encode_complex, native_encode_vector, native_encode_expr, native_interpret_int, native_interpret_real, native_interpret_complex, native_interpret_vector, native_interpret_expr): Likewise. * function.c (use_register_for_decl): Likewise. * gimplify.c (get_name): Likewise. * langhooks-def.h (lhd_return_null_const_tree): New. (LANG_HOOKS_GET_CALLEE_FNDECL): Use it. * langhooks.c (lhd_return_null_const_tree): New. * langhooks.h (lang_get_callee_fndecl): Constify. * output.h (constructor_static_from_elts_p): Likewise. * rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise. * rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode, subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise. * rtlanal.c (cached_nonzero_bits, nonzero_bits1, cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p, nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise. * rtlhooks-def.h (reg_nonzero_bits_general, reg_num_sign_bit_copies_general, reg_truncated_to_mode_general): Likewise. * rtlhooks.c (reg_num_sign_bit_copies_general, reg_nonzero_bits_general, reg_truncated_to_mode_general): Likewise. * stmt.c (warn_if_unused_value, is_body_block): Likewise. * stor-layout.c (mode_for_size_tree): Likewise. * tree-ssa-loop-im.c (memref_eq): Likewise. * tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise. * tree.c (contains_placeholder_p, type_list_equal, simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p): Likewise. * tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p, mode_for_size_tree, categorize_ctor_elements, count_type_elements, contains_placeholder_p, contains_packed_reference, get_callee_fndecl, operand_equal_for_phi_arg_p, warn_if_unused_value, is_body_block, native_encode_expr, native_interpret_expr, fold_convertible_p, operand_equal_p, int_const_binop, tree_swap_operands_p, builtin_mathfn_code, validate_arglist, simple_cst_equal, type_list_equal, use_register_for_decl, call_expr_flags, get_name, highest_pow2_factor): Likewise. (const_call_expr_arg_iterator_d, init_const_call_expr_arg_iterator, next_const_call_expr_arg, first_const_call_expr_arg, more_const_call_expr_args_p, FOR_EACH_CONST_CALL_EXPR_ARG): New. * varasm.c (constructor_static_from_elts_p): Constify. cp: * parser.c (eof_token): Un-constify. (cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc, cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious casts. java: * lang.c (java_get_callee_fndecl): Constify. objc: * objc-act.c (objc_get_callee_fndecl): Constify. * objc-act.h (objc_get_callee_fndecl): Likewise. From-SVN: r127036
2007-07-28re PR middle-end/32920 (error: type mismatch in binary expression)Richard Guenther1-4/+12
2007-07-28 Richard Guenther <rguenther@suse.de> PR middle-end/32920 * fold-const.c (fold_cond_expr_with_comparison): Convert operand zero of MIN/MAX_EXPR to correct type. * gcc.c-torture/compile/pr32920.c: New testcase. From-SVN: r127021
2007-07-26fold-const.c (fold_read_from_constant_string): Use build_int_cst_type.Daniel Jacobowitz1-4/+3
* fold-const.c (fold_read_from_constant_string): Use build_int_cst_type. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. From-SVN: r126952
2007-07-26Change copyright header to refer to version 3 of the GNU General Public ↵Nick Clifton1-4/+3
License and to point readers at the COPYING3 file and the FSF's license web page. From-SVN: r126948
2007-07-25expr.c (handled_component_p): Constify.Kaveh R. Ghazi1-1/+1
* expr.c (handled_component_p): Constify. * fold-const.c (fit_double_type): Likewise. * real.h (real_value_from_int_cst): Likewise. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all, gimple_var_anns, end_htab_p, end_referenced_vars_p, var_ann, function_ann, may_aliases, end_readonly_imm_use_p, has_zero_uses, has_single_use, single_imm_use, num_imm_uses, is_exec_stmt, is_label_stmt, is_global_var, phi_ssa_name_p, factoring_name_p, is_call_clobbered, tree_common_ann, op_iter_done, end_imm_use_stmt_p, end_imm_use_on_stmt_p, unmodifiable_var_p, array_ref_contains_indirect_ref, ref_contains_array_ref, lookup_subvars_for_var, var_can_have_subvars, overlap_subvar, gimple_ssa_operands, gimple_mem_ref_stats): Likewise. * tree-flow.h (tree_common_ann, var_ann, function_ann, may_aliases, is_exec_stmt, is_label_stmt, ref_contains_array_ref, array_ref_contains_indirect_ref, var_can_have_subvars, overlap_subvar, is_call_clobbered, unmodifiable_var_p): Likewise. * tree-gimple.c (is_gimple_min_invariant): Likewise. * tree-gimple.h (is_gimple_min_invariant): Likewise. * tree.c (type_hash_list, attribute_hash_list, tree_size, cst_and_fits_in_hwi, real_value_from_int_cst, build_real_from_int_cst, integer_zerop, integer_onep, integer_all_onesp, integer_pow2p, integer_nonzerop, tree_log2, tree_floor_log2, real_zerop, real_onep, real_twop, real_minus_onep, really_constant_p, purpose_member, chain_member, list_length, fields_length, int_size_in_bytes, bit_position, int_bit_position, byte_position, int_byte_position, expr_align, array_type_nelts, tree_node_structure, type_contains_placeholder_1, iterative_hash_pointer, is_attribute_with_length_p, is_attribute_p, check_qualified_type, tree_map_base_eq, type_hash_list, type_hash_eq, attribute_hash_list, type_num_arguments, tree_int_cst_equal, tree_int_cst_lt, tree_int_cst_compare, host_integerp, tree_low_cst, tree_int_cst_msb, tree_int_cst_sgn, simple_cst_list_equal, compare_tree_int, iterative_hash_expr, int_fits_type_p, get_containing_scope, decl_function_context, decl_type_context, omp_clause_operand_check_failed, initializer_zerop, int_cst_value, num_ending_zeros): Likewise. * tree.h (omp_clause_operand_check_failed, tree_size, build_real_from_int_cst, array_type_nelts, purpose_member, tree_int_cst_equal, tree_int_cst_lt, tree_int_cst_compare, host_integerp, tree_low_cst, tree_int_cst_msb, tree_int_cst_sgn, is_attribute_p, check_qualified_type, expr_align, int_size_in_bytes, bit_position, int_bit_position, byte_position, int_byte_position, list_length, fields_length, initializer_zerop, integer_zerop, integer_onep, integer_all_onesp, integer_pow2p, integer_nonzerop, cst_and_fits_in_hwi, num_ending_zeros, tree_node_structure, handled_component_p, get_containing_scope, decl_function_context, decl_type_context, real_zerop, type_num_arguments, fit_double_type, really_constant_p, int_fits_type_p, tree_log2, tree_floor_log2, iterative_hash_expr, compare_tree_int, chain_member, simple_cst_list_equal, real_onep, real_twop, real_minus_onep, int_cst_value): Likewise. From-SVN: r126923
2007-07-12gimplify.c (gimplify_conversion): Make sure that the result from ↵Richard Guenther1-2/+3
maybe_fold_offset_to_reference is trivially... 2007-07-12 Richard Guenther <rguenther@suse.de> * gimplify.c (gimplify_conversion): Make sure that the result from maybe_fold_offset_to_reference is trivially convertible to the desired type before doing the simplification. (gimplify_expr): Likewise. * fold-const.c (fold_binary): Use the correct types for building the simplified expression. From-SVN: r126577
2007-07-09re PR tree-optimization/32698 (inefficient pointer expression)Richard Guenther1-0/+10
2007-07-09 Richard Guenther <rguenther@suse.de> PR middle-end/32698 * fold-const.c (fold_plusminus_mult_expr): Move constant arguments second to allow decomposing. From-SVN: r126494
2007-07-02re PR middle-end/15988 (ICE in fold_convert with pointer-to-member-function)Richard Guenther1-3/+1
2007-07-02 Richard Guenther <rguenther@suse.de> * tree-flow.h (types_compatible_p): Declare. * tree-ssa.c (types_compatible_p): New function. * ipa-type-escape.c (discover_unique_type): Use types_compatible_p instead of lang_hooks.types_compatible_p. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-vn.c (expressions_equal_p): Likewise. * tree.c (fields_compatible_p): Likewise. * tree-ssa-dom.c (avail_expr_eq): Likewise. (cprop_operand): Use useless_type_conversion_p instead of lang_hooks.types_compatible_p. * tree-inline.c (setup_one_parameter): Likewise. (declare_return_variable): Likewise. * tree-nrv.c (tree_nrv): Likewise. * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. (maybe_fold_offset_to_component_ref): Likewise. (maybe_fold_offset_to_reference): Likewise. * tree-ssa-copy.c (may_propagate_copy): Likewise. (merge_alias_info): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise. * tree-ssa-phiopt.c (conditional_replacement): Likewise. * tree-ssa-reassoc.c (optimize_ops_list): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * gimplify.c (canonicalize_addr_expr): Likewise. (fold_indirect_ref_rhs): Likewise. (gimplify_addr_expr): Likewise. Swap parameters to cpt_same_type. (cpt_same_type): Likewise. (check_pointer_types_r): Swap parameters to cpt_same_type where appropriate. * fold-const.c (fold_convert): Revert fix for PR15988. * tree-inline.c (setup_one_parameter): Instead fix it here by using fold_build1 instead of fold_convert and checking for error_mark_node. Convert only if the conversion is necessary. From-SVN: r126198
2007-07-01re PR middle-end/32559 (ICE with vector arithmetic)Uros Bizjak1-19/+22
PR middle-end/32559 * fold-const.c (fold-binary) [PLUS_EXPR]: Convert ~X + X to 1 or X + ~X to 1 only for INTEGRAL_TYPE_P type. testsuite/ChangeLog: PR middle-end/32559 * gcc.dg/pr32559.c: New test. From-SVN: r126164
2007-06-27re PR middle-end/32492 (attribute always_inline -> sorry, unimplemented: ↵Richard Guenther1-0/+34
recursive inlining) 2007-06-27 Richard Guenther <rguenther@suse.de> PR middle-end/32492 * tree.h (fold_convertible_p): Declare. * fold-const.c (fold_convertible_p): New function. * gimplify.c (gimplify_call_expr): Use fold_convertible_p instead of lang_hooks.types_compatible_p. * gcc.dg/inline-22.c: New testcase. From-SVN: r126054
2007-06-24re PR tree-optimization/32461 (Segmentation fault in ↵Sebastian Pop1-7/+17
build_classic_dist_vector_1() at tree-data-ref.c:2700) PR middle-end/32461 * fold-const.c (fold_binary): Strip nops of operand 0 of BIT_NOT_EXPR before calling operand_equal_p. * testsuite/gcc.dg/tree-ssa/pr32461-1.c: New. * testsuite/gcc.dg/tree-ssa/pr32461-2.c: New. From-SVN: r125988
2007-06-23extend.texi: Document that dllimport and dllexport imply default visibility.Mark Mitchell1-3/+3
2007-06-23 Mark Mitchell <mark@codesourcery.com> * doc/extend.texi: Document that dllimport and dllexport imply default visibility. * tree.c (handle_dll_attribute): Set DECL_VISIBILITY on the imported or exported declaration, including type declarations. * c-common.c (handle_visibility_attribute): Check for conflicts with dllimport/dllexport. (c_determine_visibility): Handle dllimport/dllexport as an explicit visibility atttribute. 2007-06-23 Mark Mitchell <mark@codesourcery.com> * decl2.c (determine_visibility): Don't look for dllexport here. (determine_visibility_from_class): Tidy. 2007-06-23 Mark Mitchell <mark@codesourcery.com> * gcc.dg/visibility-12.c: New test. * gcc.dg/visibility-13.c: Likewise. * g++.dg/ext/visibility-9.C: Likewise. * g++.dg/ext/visibility-10.C: Likewise. From-SVN: r125975
2007-06-21fold-const.c (debug_fold_checksum): Move it under ENABLE_FOLD_CHECKING.Adam Nemet1-24/+24
* fold-const.c (debug_fold_checksum): Move it under ENABLE_FOLD_CHECKING. From-SVN: r125932
2007-06-21re PR middle-end/20623 (ICE: fold check: original tree changed by fold with ↵Sebastian Pop1-44/+101
--enable-checking=fold) PR middle-end/20623 * tree.h (debug_fold_checksum): Declared. * fold-const.c (build_fold_addr_expr_with_type_1): New. (build_fold_addr_expr_with_type, build_fold_addr_expr): Use build_fold_addr_expr_with_type_1. (fold_addr_expr, debug_fold_checksum): New. (fold_checksum_tree): Don't fold TREE_CHAIN of an SSA_NAME. (fold_unary, fold_comparison, split_address_to_core_and_offset): Use fold_addr_expr. From-SVN: r125929
2007-06-15[multiple changes]Andrew Pinski1-47/+135
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
2007-06-12fold-const.c (fold_binary): Guard (X-X) -> 0 transformation with !HONOR_NANS ↵Kaveh R. Ghazi1-1/+4
and !HONOR_INFINITIES. * fold-const.c (fold_binary): Guard (X-X) -> 0 transformation with !HONOR_NANS and !HONOR_INFINITIES. * simplify-rtx.c (simplify_binary_operation_1): Likewise. From-SVN: r125652
2007-06-12fold-const (fold_binary): Also optimize a/cbrt(b/c) into a*cbrt(c/b) if ↵Uros Bizjak1-2/+2
flag_unsafe_math_optimizations is set. * fold-const (fold_binary) [RDIV_EXPR]: Also optimize a/cbrt(b/c) into a*cbrt(c/b) if flag_unsafe_math_optimizations is set. testuite/ChangeLog: * gcc.dg/builtins-11.c: Also check folding of a/cbrt(b/c). From-SVN: r125641
2007-06-11really remove signed(_or_unsigned)?_type langhooksRafael Espindola1-13/+13
From-SVN: r125621
2007-06-11re PR middle-end/32279 (Fold 1.0/sqrt(x/y) to sqrt(y/x))Uros Bizjak1-0/+18
PR middle-end/32279 * fold-const (fold_binary) [RDIV_EXPR]: Optimize a/sqrt(b/c) into a*sqrt(c/b) if flag_unsafe_math_optimizations is set. testsuite/ChangeLog: PR middle-end/32279 * gcc.dg/builtins-11.c: Also check folding of a/sqrt(b/c). From-SVN: r125614
2007-06-06fold-const.c (merge_ranges): If range_successor or range_predecessor fail, ↵Ian Lance Taylor1-3/+19
just return 0. ./: * fold-const.c (merge_ranges): If range_successor or range_predecessor fail, just return 0. testsuite/: * g++.dg/conversion/enum1.C: New test. From-SVN: r125486
2007-05-30re PR middle-end/32152 (omp lowering creates mismatched types)Richard Guenther1-1/+1
2007-05-30 Richard Guenther <rguenther@suse.de> PR middle-end/32152 * gimplify.c (gimplify_omp_atomic_pipeline): Use correct types for comparison. * fold-const.c (fold_comparison): Call maybe_canonicalize_comparison with original typed arguments. * config/i386/i386.c (ix86_gimplify_va_arg): Fix type mismatches. From-SVN: r125187
2007-05-28re PR tree-optimization/32100 (vrp bitfield miscompilation)Andrew Pinski1-3/+8
2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32100 * fold-const.c (tree_expr_nonnegative_warnv_p): Don't return true when truth_value_p is true and the type is of signed:1. 2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32100 * gcc.c-torture/execute/vrp-7.c: New test. From-SVN: r125139
2007-05-26i386.c, [...]: Fix comment typos.Kazu Hirata1-3/+3
* config/i386/i386.c, config/pa/pa.c, config/spu/spu.c, df-problems.c, df-scan.c, domwalk.c, ebitmap.c, ebitmap.h, fold-const.c, gcc.c, ipa-type-escape.c, omega.c, omega.h, tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-structalias.c, tree-vrp.c: Fix comment typos. Follow spelling conventions. * doc/tm.texi: Follow spelling conventions. From-SVN: r125090
2007-05-25cfglayout.c, [...]: Fix comment typos.Kazu Hirata1-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
2007-05-14c-common.c (warnings_for_convert_and_check): Use unsigned_type_for instead ↵Rafael Avila de Espindola1-6/+6
of c_common_unsigned_type. gcc/ * c-common.c (warnings_for_convert_and_check): Use unsigned_type_for instead of c_common_unsigned_type. (c_common_unsigned_type): Remove. (shorten_compare): Use c_common_signed_or_unsigned_type instead of c_common_unsigned_type. (c_common_nodes_and_builtins): Use unsigned_type_for instead of c_common_unsigned_type. * c-common.h (c_common_unsigned_type): Remove. * c-decl.c (grokdeclarator): Use unsigned_type_for instead of c_common_unsigned_type. * c-format.c (check_format_types): Use unsigned_type_for instead of c_common_unsigned_type. * c-objc-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * c-typeck.c (convert_for_assignment): Use unsigned_type_for instead of c_common_unsigned_type. * convert.c (convert_to_integer): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. * expmed.c (make_tree): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. * fold-const.c (fold_negate_expr): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. (build_range_check): Likewise. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Likewise. * langhooks-def.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * langhooks.h (lang_hooks_for_types): Remove unsigned_type. * tree.c (get_unsigned_type): New. (unsigned_type_for): Use get_unsigned_type instead of lang_hooks.types.unsigned_type gcc/ada * misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. gcc/cp * cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * decl.c (grokdeclarator): Use unsigned_type_for instead of c_common_unsigned_type. gcc/fortran * f95-lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. * trans-intrinsic.c (gfc_conv_intrinsic_ishft): Use unsigned_type_for instead of gfc_unsigned_type. * trans-stmt.c (gfc_trans_do): Use unsigned_type_for instead of gfc_unsigned_type. * trans-types.c (gfc_unsigned_type): Remove. * trans-types.h (gfc_unsigned_type): Remove. gcc/java * expr.c (build_java_binop): Use unsigned_type_for instead of java_unsigned_type. * java-tree.h (java_unsigned_type): Remove. * lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. * typeck.c (java_unsigned_type): Remove. gcc/treelang * treetree.c (tree_lang_unsigned_type): Remove. (LANG_HOOKS_UNSIGNED_TYPE): Remove. From-SVN: r124715
2007-05-04fold-const.c (fold_unary): Convert (T1)(X op Y) into ((T1)X op (T1)Y)...Jan Hubicka1-15/+11
* fold-const.c (fold_unary): Convert (T1)(X op Y) into ((T1)X op (T1)Y), for pointer type in more cases than before. * gimplify.c (gimplify_expr): Fold (void *)&a + 4. * tree-object-size.c (plus_expr_object_size): When operand size is unknown, return unknown. From-SVN: r124403
2007-05-02fold-const.c (fold_comparision): Remove the "foo++ == CONST" transformation.Andrew Pinski1-63/+0
2007-05-02 Andrew Pinski <andrew_pinski@playstation.sony.com> * fold-const.c (fold_comparision): Remove the "foo++ == CONST" transformation. From-SVN: r124353
2007-05-01tree.h (maybe_fold_offset_to_component_ref): Remove.Jan Hubicka1-7/+0
* tree.h (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_offset_to_reference): Declare. * fold-const.c (fold_unary): Do not fold (type *)&A into &A->field_of_type_and_offset_0 * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): When base type size is unknown, give up. (maybe_fold_offset_to_component_ref): Ignore firelds with unknown offsets. (maybe_fold_offset_to_reference): New. (maybe_fold_stmt_indirect): Use it. (fold_stmt_r): Fold (type *)&A+offset into A->field_if_type_and_offset. * gimplify.c (gimplify_conversion): Canonicalize conversions to field references. (gimplify_expr): Likewise for plus_expr. From-SVN: r124323
2007-04-24fix for PR31617Olga Golovanevsky1-0/+1
From-SVN: r124109
2007-04-21re PR tree-optimization/31136 (FRE ignores bit-field truncation (C and C++ ↵Richard Guenther1-1/+1
front-end don't produce bit-field truncation) 2007-04-21 Richard Guenther <rguenther@suse.de> PR middle-end/31136 * fold-const.c (fold_unary): Call fold_convert_const on the original tree. * gcc.c-torture/execute/pr31136.c: New testcase. From-SVN: r124020
2007-04-20re PR tree-optimization/31632 (ICE in compare_values)Jakub Jelinek1-13/+20
PR tree-optimization/31632 * fold-const.c (fold_binary): Use op0 and op1 instead of arg0 and arg1 for optimizations of comparison against min/max values. Fold arg0 to arg1's type for optimizations of comparison against min+1 and max-1 values. * gcc.c-torture/compile/20070419-1.c: New test. From-SVN: r123988