aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2008-04-08fold-const.c (fold_widened_comparison): Do not allow sign-changes that ↵Richard Guenther1-1/+5
change the result. 2008-04-08 Richard Guenther <rguenther@suse.de> * fold-const.c (fold_widened_comparison): Do not allow sign-changes that change the result. * gcc.c-torture/execute/20080408-1.c: New testcase. From-SVN: r134108
2008-04-08fold-canst.c (tree_call_nonnegative_warnv_p): New.Rafael Avila de Espindola1-125/+142
2008-04-08 Rafael Espindola <espindola@google.com> * fold-canst.c (tree_call_nonnegative_warnv_p): New. (tree_invalid_nonnegative_warnv_p): Use tree_call_nonnegative_warnv_p. * tree.h (tree_call_nonnegative_warnv_p): New. From-SVN: r134102
2008-04-07fold-const.c (fold): New case.Eric Botcazou1-0/+39
* fold-const.c (fold) <ARRAY_REF>: New case. Try to fold constant reference in constructor with non self-referential type. ada/ * utils2.c (build_binary_op): Fold ARRAY_REF and ARRAY_RANGE_REF too. From-SVN: r133977
2008-04-04re PR middle-end/35823 (verify_gimple fails on taking 'Size of a String ↵Richard Guenther1-1/+2
subprogram parameter) 2008-04-04 Richard Guenther <rguenther@suse.de> PR middle-end/35823 * fold-const.c (optimize_minmax_comparison): Use the correct type for the constant in the simplified comparison. * gnat.dg/pr35823.adb: New testcase. From-SVN: r133893
2008-04-01re PR middle-end/35705 (Symbol address check eliminated by C frontend.)John David Anglin1-1/+1
PR middle-end/35705 * fold-const.c (get_pointer_modulus_and_residue): Return modulus 1 if the expression is a function address. From-SVN: r133804
2008-03-31re PR tree-optimization/30186 (accessing an element via a "pointer" on a ↵Andrew Pinski1-0/+28
vector does not cause vec_extract to be used (non-zero index)) 2008-03-31 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/30186 * fold-const.c (fold_indirect_ref_1): Support accessing non first element of the vector via a pointer. 2008-03-31 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/30186 * gcc.dg/tree-ssa/vector-1.c: New testcase. * gcc.c-torture/execute/vector-1.c: New testcase. * gcc.c-torture/execute/vector-2.c: New testcase. From-SVN: r133766
2008-03-30fold-const.c (fold_binary): Add missing conversions.Eric Botcazou1-2/+4
* fold-const.c (fold_binary) <BIT_IOR_EXPR>: Add missing conversions. From-SVN: r133732
2008-03-30re PR middle-end/31023 (Fold is agnostic of integer sub-types)Richard Guenther1-0/+5
2008-03-30 Richard Guenther <rguenther@suse.de> PR middle-end/31023 * fold-const.c (fold_sign_changed_comparison): Do leave conversions to base-types alone. From-SVN: r133731
2008-03-28fold-const.c (tree_unary_nonnegative_warnv_p): Make it public.Rafael Avila de Espindola1-7/+7
2008-03-28 Rafael Espindola <espindola@google.com> * fold-const.c (tree_unary_nonnegative_warnv_p): Make it public. (tree_binary_nonnegative_warnv_p): Make it public. (tree_single_nonnegative_warnv_p): Make it public. (tree_invalid_nonnegative_warnv_p): Make it public. (tree_unary_nonzero_warnv_p): Make it public. (tree_binary_nonzero_warnv_p): Make it public (tree_single_nonzero_warnv_p): Make it public. * tree-vrp.c (vrp_evaluate_conditional_warnv_with_ops): New function. (extract_range_from_binary_expr): Split the expr argument. (extract_range_from_unary_expr): Split the expr argument. (extract_range_from_comparison): Split the expr argument. (extract_range_from_expr): Use the new aux functions. (vrp_evaluate_conditional_warnv): Use vrp_evaluate_conditional_warnv_with_ops. * tree.h (tree_unary_nonzero_warnv_p): Declare. (tree_binary_nonzero_warnv_p): Declare. (tree_single_nonzero_warnv_p): Declare. (tree_expr_nonzero_warnv_p): Declare. (tree_unary_nonnegative_warnv_p): Declare. (tree_binary_nonnegative_warnv_p): Declare. (tree_single_nonnegative_warnv_p): Declare. (tree_invalid_nonnegative_warnv_p): Declare. From-SVN: r133681
2008-03-27re PR tree-optimization/35716 (gfortran.dg/assign_6.f and ↵Richard Guenther1-3/+7
gfortran.dg/g77/dnrm2.f) 2008-03-27 Richard Guenther <rguenther@suse.de> PR middle-end/35716 * fold-const.c (fold_comparison): Restrict distinct decl comparison folding to VAR_DECLs and PARM_DECLs. Do not solely rely on operand_equal_p. From-SVN: r133647
2008-03-27fold-const.c (target.h): Include.Richard Guenther1-32/+46
2008-03-27 Richard Guenther <rguenther@suse.de> * fold-const.c (target.h): Include. (fold_comparison): Fold comparison of addresses of decls that bind locally or of constants. Consolidate address folding code. * tree-vrp.c (operand_less_p): Deal with non-INTEGER_CST results from fold_binary_to_constant. (compare_values_warnv): Likewise. * gcc.dg/fold-addr-1.c: New testcase. From-SVN: r133632
2008-03-27re PR tree-optimization/35429 (ICE with complex arithmetic)Andrew Pinski1-2/+4
2008-03-27 Andrew Pinski <pinskia@gmail.com> PR middle-end/35429 * fold-const.c (fold_truthop): Check for integeral types when folding a == 0 && b == 0 and a != 0 || b != 0 . 2008-03-27 Andrew Pinski <pinskia@gmail.com> PR middle-end/35429 * gcc.c-torture/compile/complex-5.c: New test. From-SVN: r133631
2008-03-26revert: fold-const.c (target.h): Include.Richard Guenther1-39/+32
2008-03-26 Richard Guenther <rguenther@suse.de> Revert 2008-03-26 Richard Guenther <rguenther@suse.de> * fold-const.c (target.h): Include. (fold_comparison): Fold comparison of addresses of two decls that bind locally. Consolidate address folding code. * gcc.dg/fold-addr-1.c: New testcase. From-SVN: r133608
2008-03-26fold-const.c (target.h): Include.Richard Guenther1-32/+39
2008-03-26 Richard Guenther <rguenther@suse.de> * fold-const.c (target.h): Include. (fold_comparison): Fold comparison of addresses of two decls that bind locally. Consolidate address folding code. * gcc.dg/fold-addr-1.c: New testcase. From-SVN: r133599
2008-03-17re PR tree-optimization/19637 (Missed VRP and FRE opportunities in the ↵Richard Guenther1-7/+2
presence of casts) 2008-03-17 Richard Guenther <rguenther@suse.de> PR tree-optimization/19637 * fold-const.c (fold_unary): Remove restrictions of removing intermediate pointer-conversions (P2)(P1)P0. * tree-ssa-ccp.c (maybe_fold_stmt_addition): Recover from conversion to void pointer. (get_maxval_strlen): Handle addresses of the form &(*p)[0]. * g++.dg/tree-ssa/pr19637.C: New testcase. From-SVN: r133291
2008-03-14re PR tree-optimization/34043 (Missed optimization causing extra loads and ↵Richard Guenther1-8/+13
stores when using x86_64 builtin function together with aggregate types.) 2008-03-14 Richard Guenther <rguenther@suse.de> PR tree-optimization/34043 PR tree-optimization/33989 * tree-ssa-pre.c (execute_pre): Allow SCCVN to do insertion when doing FRE. (bitmap_find_leader): Use extra argument to verify dominance relationship inside a basic-block. (can_PRE_operation): Add VIEW_CONVERT_EXPR. (find_leader_in_sets): Adjust. (create_component_ref_by_pieces): Take extra argument for dominance check, handle lookup failures. (find_or_generate_expression): Likewise. (create_expression_by_pieces): Likewise. (insert_into_preds_of_block): Adjust. (create_value_expr_from): If asked for, verify all operands are in the blocks AVAIL_OUT set. (make_values_for_stmt): Check for SSA_NAMEs that are life over an abnormal edge. (compute_avail): Remove such check. (do_SCCVN_insertion): New function. (eliminate): If we do not find a leader suitable for replacement insert a replacement expression from SCCVN if available. * tree-ssa-sccvn.h (run_scc_vn): Update prototype. (struct vn_ssa_aux): Add needs_insertion flag. * tree-ssa-sccvn.c (may_insert): New global flag. (copy_reference_ops_from_ref): Value-number union member access based on its size, not type and member if insertion is allowed. (visit_reference_op_load): For a weak match from union type punning lookup a view-converted value and insert a SSA_NAME for that value if that is not found. (visit_use): Make dumps shorter. Do not disallow value numbering SSA_NAMEs that are life over an abnormal edge to constants. (free_scc_vn): Release inserted SSA_NAMEs. (run_scc_vn): New flag to specify whether insertion is allowed. Process SSA_NAMEs in forward order. * tree-ssa-loop-im.c (for_each_index): Handle invariant ADDR_EXPRs inside VIEW_CONVERT_EXPR. * fold-const.c (fold_unary): Fold VIEW_CONVERT_EXPRs from/to pointer type to/from integral types that do not change the precision to regular conversions. * gcc.dg/tree-ssa/ssa-fre-7.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-8.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-9.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-10.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-17.c: Likewise. From-SVN: r133218
2008-03-12re PR rtl-optimization/34522 (inefficient code for long long multiply when ↵Paolo Bonzini1-0/+20
only low bits are needed) 2008-03-12 Paolo Bonzini <bonzini@gnu.org> PR tree-opt/35422 * fold-const.c (fold_unary) <NOP_EXPR>: Distribute a narrowing conversion to the operands of a multiplication. testsuite: 2008-03-12 Paolo Bonzini <bonzini@gnu.org> PR tree-opt/35422 * gcc.dg/vect/slp-7.c: Change target keywords required for vectorizing third loop. * gcc.target/i386/pr35422.c: New. From-SVN: r133144
2008-03-05re PR c++/35336 (Broken diagnostic: 'bit_field_ref' not supported by dump_expr)Richard Guenther1-364/+6
2008-03-05 Richard Guenther <rguenther@suse.de> PR c++/35336 * tree.def (BIT_FIELD_REF): Document that operands 1 and 2 should be constants. * tree-cfg.c (verify_expr): Verify it. * fold-const.c (fold_truthop): Remove code generating BIT_FIELD_REFs of structure bases. (fold_binary): Likewise. (fold_ternary): Position and size of BIT_FIELD_REFs are always host integers. (make_bit_field_ref): Remove. (optimize_bit_field_compare): Remove. (all_ones_mask_p): Remove. From-SVN: r132894
2008-03-05fold-const.c (tree_single_nonnegative_warnv_p): Fix mixed declaration and code.Geoffrey Keating1-3/+2
* fold-const.c (tree_single_nonnegative_warnv_p): Fix mixed declaration and code. (tree_invalid_nonnegative_warnv_p): Likewise. From-SVN: r132886
2008-03-04fold-const.c (tree_simple_nonnegative_warnv_p): New.Rafael Avila de Espindola1-94/+238
2008-03-04 Rafael Espindola <espindola@google.com> * fold-const.c (tree_simple_nonnegative_warnv_p): New. (tree_unary_nonnegative_warnv_p): New. (tree_binary_nonnegative_warnv_p): New. (tree_single_nonnegative_warnv_p): New. (tree_invalid_nonnegative_warnv_p): New. (tree_expr_nonnegative_warnv_p): Redefine in term of the new functions. From-SVN: r132875
2008-03-04fold-const.c (tree_unary_nonzero_warnv_p): New.Rafael Avila de Espindola1-74/+187
2008-03-04 Rafael Espindola <espindola@google.com> * fold-const.c (tree_unary_nonzero_warnv_p): New. (tree_binary_nonzero_warnv_p): New. (tree_single_nonzero_warnv_p): New. (tree_expr_nonzero_warnv_p): Redefine using the new functions. From-SVN: r132866
2008-03-04re PR middle-end/35456 (Different results for inlined vs. non-inlined function)Uros Bizjak1-5/+8
PR middle-end/35456 * fold-const.c (fold_cond_expr_with_comparison): Prevent transformations for modes that have signed zeros. * ifcvt.c (noce_try_abs): Ditto. testsuite/ChangeLog: PR middle-end/35456 * gcc.c-torture/execute/pr35456.c: New test. From-SVN: r132863
2008-03-03tree-ssa-sccvn.c (visit_reference_op_store): Do not insert struct copies ↵Richard Guenther1-6/+21
into the expression table. 2008-03-03 Richard Guenther <rguenther@suse.de> * tree-ssa-sccvn.c (visit_reference_op_store): Do not insert struct copies into the expression table. (simplify_unary_expression): Handle VIEW_CONVERT_EXPR. (try_to_simplify): Likewise. * fold-const.c (fold_unary): Fold VIEW_CONVERT_EXPR of integral and pointer arguments which do not change the precision to NOP_EXPRs. * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Adjust VIEW_CONVERT_EXPR case. From-SVN: r132836
2008-02-29fold-const.c (fold_convertible_p): Correct the logic to follow that in ↵Francois-Xavier Coudert1-1/+8
fold_convert(). * fold-const.c (fold_convertible_p): Correct the logic to follow that in fold_convert(). From-SVN: r132780
2008-02-27re PR tree-optimization/25290 (PHI-OPT could be rewritten so that is uses fold)Richard Guenther1-1/+1
2008-02-27 Richard Guenther <rguenther@suse.de> PR middle-end/25290 * fold-const.c (fold_unary): Return the correct argument, converted to the result type. * gcc.c-torture/execute/pr35390.c: New testcase. From-SVN: r132710
2008-02-27re PR middle-end/34971 (bitfield rotates are folded and expanded wrong)Richard Guenther1-5/+10
2008-02-27 Richard Guenther <rguenther@suse.de> PR middle-end/34971 * expr.c (expand_expr_real_1): Assert on rotates that operate on partial modes. * fold-const.c (fold_binary): Use the types precision, not the bitsize of the mode if folding rotate expressions. Build rotates only for full modes. * gcc.c-torture/execute/pr34971.c: New testcase. From-SVN: r132706
2008-02-21tree.def (PAREN_EXPR): New tree code.Richard Guenther1-0/+8
2008-02-21 Richard Guenther <rguenther@suse.de> * tree.def (PAREN_EXPR): New tree code. * fold-const.c (fold_unary): Remove PAREN_EXPR around constants and PAREN_EXPR. * tree-pretty-print.c (dump_generic_node): Handle PAREN_EXPR. * expr.c (expand_expr_real_1): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * tree-complex.c (expand_complex_move): Likewise. * tree-vectorizer.c (vect_is_simple_use): Treat PAREN_EXPR (x) as plain x. * trans-expr.c (gfc_conv_expr_op): Expand INTRINSIC_PARENTHESES as unary PAREN_EXPR for real and complex typed expressions. (gfc_conv_unary_op): Fold the built tree. * gfortran.dg/reassoc_1.f90: New testcase. * gfortran.dg/reassoc_2.f90: Likewise. * gfortran.dg/reassoc_3.f90: Likewise. From-SVN: r132515
2008-02-20fold-const.c (split_tree): Associate floatig-point expressions if ↵Richard Guenther1-1/+1
flag_associative_math is set. 2008-02-20 Richard Guenther <rguenther@suse.de> * fold-const.c (split_tree): Associate floatig-point expressions if flag_associative_math is set. * gcc.dg/fold-reassoc-1.c: New testcase. * gcc.dg/tree-ssa/recip-3.c: Adjust to not compute d/d. From-SVN: r132481
2008-02-20tree.h (fold_real_zero_addition_p): Declare.Richard Guenther1-2/+1
2008-02-20 Richard Guenther <rguenther@suse.de> * tree.h (fold_real_zero_addition_p): Declare. * fold-const.c (fold_real_zero_addition_p): Export. * tree-ssa-reassoc.c (eliminate_using_constants): Also handle floating-point operations with zero and one. * gcc.dg/tree-ssa/reassoc-13.c: New testcase. From-SVN: r132480
2008-02-12re PR middle-end/35163 (folding comparison loses cast)Richard Guenther1-1/+3
2008-02-12 Richard Guenther <rguenther@suse.de> PR middle-end/35163 * fold-const.c (fold_widened_comparison): Use get_unwidened in value-preserving mode. Disallow final truncation. * gcc.c-torture/execute/pr35163.c: New testcase. From-SVN: r132269
2008-01-16re PR middle-end/32628 (bogus integer overflow warning)Richard Guenther1-2/+16
2008-01-16 Richard Guenther <rguenther@suse.de> PR middle-end/32628 * fold-const.c (fold_convert_const_int_from_int): Do not set overflow if that occured only because of a sign extension change when converting from/to a sizetype with the same precision and signedness. * gcc.dg/overflow-warn-7.c: New testcase. From-SVN: r131579
2008-01-12re PR ada/33788 (GNAT bug box in expand_expr_addr_expr_1, at expr.c:6862)Eric Botcazou1-1/+6
PR ada/33788 * fold-const.c (fold_unary) <VIEW_CONVERT_EXPR>: Fold an existing NOP_EXPR if it is between integral types with the same precision. From-SVN: r131493
2007-12-05re PR middle-end/34337 (Internal error while building gtkwhiteboardc.c from ↵Jakub Jelinek1-6/+25
pidgin 2.3.0) PR middle-end/34337 * fold-const.c (fold_binary) <case BIT_IOR_EXPR>: Don't minimize number of bits set in C1 if a mode mask for some mode can be used instead. * gcc.c-torture/execute/20071205-1.c: New test. From-SVN: r130635
2007-12-03re PR middle-end/29749 (Missing byte swap optimizations)Jakub Jelinek1-0/+113
PR middle-end/29749 * fold-const.c (fold_binary) <case BIT_AND_EXPR>: Optimize (X << C1) & C2 into (X << C1) & (C2 | ((1 << C1) - 1)) and (X >> C1) & C2 into (X >> C1) & (C2 | ~((type) -1 >> C1)). (fold_binary) <case LSHIFT_EXPR, case RSHIFT_EXPR>: Optimize (X & C2) << C1 into (X << C1) & (C2 << C1) and (X & C2) >> C1 into (X >> C1) & (C2 >> C1) if that allows further optimizations. * gcc.dg/fold-rotate-1.c: New test. From-SVN: r130589
2007-11-17re PR middle-end/34130 (the builtin abs() gives wrong result when used in ↵Richard Guenther1-0/+3
some expression) 2007-11-17 Richard Guenther <rguenther@suse.de> PR middle-end/34130 * fold-const.c (extract_muldiv_1): Do not move negative constants inside ABS_EXPR. * gcc.c-torture/execute/pr34130.c: New testcase. From-SVN: r130258
2007-11-16re PR middle-end/34030 (ICE in in compare_values_warnv, at tree-vrp.c:701)Richard Guenther1-18/+18
2007-11-16 Richard Guenther <rguenther@suse.de> PR middle-end/34030 * fold-const.c (fold_binary): Use correct types for folding 1 << X & Y to Y >> X & 1. * gcc.c-torture/compile/pr34030.c: New testcase. From-SVN: r130238
2007-11-12re PR middle-end/34070 (Wrong code for (int)x%4)Richard Guenther1-2/+2
2007-11-12 Richard Guenther <rguenther@suse.de> PR middle-end/34070 * fold-const.c (fold_binary): If testing for non-negative operands with tree_expr_nonnegative_warnv_p make sure to use op0 which has all (sign) conversions retained. * gcc.c-torture/execute/pr34070-1.c: New testcase. * gcc.c-torture/execute/pr34070-2.c: Likewise. From-SVN: r130098
2007-11-12re PR tree-optimization/34027 (-Os code size nearly doubled)Richard Guenther1-0/+36
2007-11-12 Richard Guenther <rguenther@suse.de> PR middle-end/34027 * fold-const.c (fold_binary): Fold n - (n / m) * m to n % m. (fold_binary): Fold unsinged FLOOR_DIV_EXPR to TRUNC_DIV_EXPR. * gcc.dg/pr34027-1.c: New testcase. * gcc.dg/pr34027-2.c: Likewise. From-SVN: r130097
2007-11-04re PR middle-end/32931 (FORALL and WHERE give an ICE with -m64)Andrew Pinski1-2/+2
2007-11-04 Andrew Pinski <pinskia@gmail.com> PR middle-end/32931 * fold-const.c (fold_binary <case EQ_EXPR>): Convert the inner type for TRUTH_NOT_EXPR to type. 2007-11-04 Andrew Pinski <pinskia@gmail.com> PR middle-end/32931 * gfortran.fortran-torture/compile/forall-1.f90: New testcase. From-SVN: r129886
2007-10-31re PR middle-end/33779 (folds unsigned multiplication == 0 to true)Richard Guenther1-4/+7
2007-10-31 Richard Guenther <rguenther@suse.de> PR middle-end/33779 * fold-const.c (extract_muldiv_1): Make sure to not introduce new undefined integer overflow. (fold_binary): Avoid useless conversion. * gcc.c-torture/execute/pr33779-1.c: New testcase. * gcc.c-torture/execute/pr33779-2.c: Likewise. From-SVN: r129796
2007-10-30re PR c++/33709 (Type verification failure with new expression)Jakub Jelinek1-3/+6
PR c++/33709 * fold-const.c (fold_binary): If one argument is COMPOUND_EXPR, convert second operand of COMPOUND_EXPR to the original type of that argument. * g++.dg/opt/compound1.C: New test. From-SVN: r129785
2007-10-15fold-const.c (extract_array_ref): Remove.Richard Guenther1-114/+15
2007-10-15 Richard Guenther <rguenther@suse.de> * fold-const.c (extract_array_ref): Remove. (fold_comparison): Handle POINTER_PLUS_EXPR with the generic address expression comparison folding. Remove the folding that used extract_array_ref. From-SVN: r129347
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