aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
AgeCommit message (Collapse)AuthorFilesLines
2008-06-25re PR tree-optimization/35518 (FAIL: gcc.c-torture/execute/20040709-1.c ↵Richard Guenther1-0/+7
execution at -O2 and above) 2008-06-25 Richard Guenther <rguenther@suse.de> PR tree-optimization/35518 * fold-const.c (fold_ternary): Strip trivial BIT_FIELD_REFs. * tree-sra.c (instantiate_element): Use fold_build3 to build BIT_FIELD_REFs. (try_instantiate_multiple_fields): Likewise. From-SVN: r137100
2008-06-06cgraph.c: Fix typos in comments.Ralf Wildenhues1-2/+2
gcc/ * cgraph.c: Fix typos in comments. (cgraph_availability_names): Fix string typo. * fold-const.c: Fix typos in comments. (fold_binary): Fix typo in warning. * genautomata.c: Fix typos in comments. (check_presence_pattern_sets): Fix typo in local variable. (output_description): Fix typo in output. * ggc-zone.c (ggc_pch_finish): Fix typo in error message. * hwint.h: Likewise. * matrix-reorg.c (check_allocation_function): Likewise. * omega.c (smooth_weird_equations): Likewise. * auto-inc-dec.c: Fix typos in comments. * bb-reorder.c: Likewise. * builtins.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfglayout.c: Likewise. * cfgloopmanip.c: Likewise. * cgraphunit.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * dse.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * function.c: Likewise. * function.h: Likewise. * gcc.c: Likewise. * gcov-io.c: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattrtab.c: Likewise. * ggc-page.c: Likewise. * gimplify.c: Likewise. * gthr-lynx.h: Likewise. * haifa-sched.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa.c: Likewise. * loop-doloop.c: Likewise. * mips-tfile.c: Likewise. * mkmap-flat.awk: Likewise. * mkmap-symver.awk: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts.c: Likewise. * passes.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * pretty-print.h: Likewise. * profile.c: Likewise. * protoize.c: Likewise. * ra-conflict.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * regclass.c: Likewise. * regs.h: Likewise. * reload.c: Likewise. * rtl-error.c: Likewise. * rtlanal.c: Likewise. * scan.h: Likewise. * sched-rgn.c: Likewise. * see.c: Likewise. * stmt.c: Likewise. * target.h: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-analyze.c: Likewise. * tree-vect-transform.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vn.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * unwind-dw2-fde.c: Likewise. * unwind.inc: Likewise. * value-prof.c: Likewise. * vmsdbgout.c: Likewise. From-SVN: r136425
2008-05-31re PR tree-optimization/34244 (VRP/SCEV miscompiles Firefox)Richard Guenther1-10/+0
2008-05-31 Richard Guenther <rguenther@suse.de> PR tree-optimization/34244 * fold-const.c (tree_expr_nonnegative_warnv_p): Do not ask VRP. (tree_expr_nonzero_warnv_p): Likewise. * tree-vrp.c (vrp_expr_computes_nonnegative): Call ssa_name_nonnegative_p. (vrp_expr_computes_nonzero): Call ssa_name_nonzero_p. (extract_range_from_unary_expr): Use vrp_expr_computes_nonzero, not tree_expr_nonzero_warnv_p. PR tree-optimization/36262 Revert 2007-11-29 Zdenek Dvorak <ook@ucw.cz> PR tree-optimization/34244 * tree-vrp.c (adjust_range_with_scev): Clear scev cache. (record_numbers_of_iterations): New function. (execute_vrp): Cache the numbers of iterations of loops. * tree-scalar-evolution.c (scev_reset_except_niters): New function. (scev_reset): Use scev_reset_except_niters. * tree-scalar-evolution.h (scev_reset_except_niters): Declare. From-SVN: r136237
2008-05-30* fold-const.c (fold_unary) <CASE_CONVERT>: Add ??? comment.Eric Botcazou1-1/+4
From-SVN: r136200
2008-05-26re PR middle-end/36300 (Incorrect type used for inlined expression)Richard Guenther1-7/+7
2008-05-26 Richard Guenther <rguenther@suse.de> PR middle-end/36300 * fold-const.c (extract_muldiv_1): Use TYPE_OVERFLOW_WRAPS, not TYPE_UNSIGNED. Use TYPE_PRECISION instead of GET_MODE_SIZE. * gcc.dg/pr36300-1.c: New testcase. * gcc.dg/pr36300-2.c: Likewise. From-SVN: r135913
2008-05-18re PR middle-end/35509 (builtin isinf() mismatch to compile-time substitution)Kaveh R. Ghazi1-0/+3
PR middle-end/35509 * builtins.c (mathfn_built_in_1): Renamed from mathfn_built_in. Add `implicit' parameter. Handle BUILT_IN_SIGNBIT. (mathfn_built_in): Rewrite in terms of mathfn_built_in_1. (fold_builtin_classify): Handle BUILT_IN_ISINF_SIGN. (fold_builtin_1): Likewise. * builtins.def (BUILT_IN_ISINF_SIGN): New. c-common.c (check_builtin_function_arguments): Handle BUILT_IN_ISINF_SIGN. * doc/extend.texi: Document __builtin_isinf_sign. * fold-const.c (operand_equal_p): Handle COND_EXPR. testsuite: * gcc.dg/builtins-error.c: Test __builtin_isinf_sign. * gcc.dg/tg-tests.h: Likewise. Mark variables volatile. * gcc.dg/torture/builtin-isinf_sign-1.c: New test. From-SVN: r135517
2008-05-17fold-const.c (fold_unary): Fold the cast into a BIT_AND_EXPR only for an ↵Eric Botcazou1-2/+1
INTEGER_TYPE. * fold-const.c (fold_unary) <CASE_CONVERT>: Fold the cast into a BIT_AND_EXPR only for an INTEGER_TYPE. From-SVN: r135467
2008-05-13re PR middle-end/36227 (POINTER_PLUS folding introduces undefined overflow)Richard Guenther1-1/+2
2008-05-13 Richard Guenther <rguenther@suse.de> PR middle-end/36227 * fold-const.c (fold_sign_changed_comparison): Do not allow changes in pointer-ness. * gcc.dg/pr36227.c: New testcase. From-SVN: r135260
2008-05-09pa.c (reloc_needed): Use CASE_CONVERT.Tomas Bily1-22/+12
* config/pa/pa.c (reloc_needed): Use CASE_CONVERT. * tree-cfg.c (verify_expr, verify_gimple_expr): Likewise. * tree-ssa-structalias.c (get_constraint_for): Likewise. * c-common.c (c_common_truthvalue_conversion): Likewise. * tree-object-size.c (compute_object_offset): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * varasm.c (const_hash_1, compare_constant, copy_constant) (compute_reloc_for_constant, output_addressed_constants) (initializer_constant_valid_p): Likewise. * c-omp.c (check_omp_for_incr_expr): Likewise. * gimplify.c (gimplify_expr): Likewise. * c-typeck.c (c_finish_return): Likewise. * tree-vectorizer.c (supportable_widening_operation) (supportable_narrowing_operation): Likewise. * c-pretty-print.c (pp_c_cast_expression, pp_c_expression): Likewise. * matrix-reorg.c (can_calculate_expr_before_stmt): Likewise. * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info) (descr_info_loc): Likewise. * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. * fold-const.c (operand_equal_p, make_range, extract_muldiv_1) (fold_unary): Likewise. * builtins.c (get_pointer_alignment): Likewise. * tree-scalar-evolution.c (interpret_rhs_modify_stmt) (instantiate_parameters_1): Likewise. * tree.c (expr_align, stabilize_reference): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * tree-ssa-loop-niter.c (derive_constant_upper_bound): Likewise. * convert.c (strip_float_extensions): Use CONVERT_EXPR_P. * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. * config/alpha/alpha.c (va_list_skip_additions): Likewise. * c-common.c (c_alignof_expr, check_function_arguments_recurse): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Likewise. * varasm.c (initializer_constant_valid_p, output_constant): Likewise. * tree-ssa-forwprop.c (get_prop_source_stmt, can_propagate_from) (forward_propagate_addr_expr_1, forward_propagate_addr_expr) (forward_propagate_comparison) (tree_ssa_forward_propagate_single_use_vars): Likewise. * cfgexpand.c (discover_nonconstant_array_refs_r): Likewise. * emit-rtl.c (component_ref_for_mem_expr) (set_mem_attributes_minus_bitpos): Likewise. * tree-ssa-phiopt.c (conditional_replacement): Likewise. * gimplify.c (gimplify_conversion, goa_lhs_expr_p, gimplify_expr): Likewise. * c-typeck.c (default_function_array_conversion, build_indirect_ref) (build_function_call, pointer_diff, build_compound_expr) (c_finish_return): Likewise. * tree-vect-analyze.c (vect_determine_vectorization_factor): Likewise. * matrix-reorg.c (get_inner_of_cast_expr, may_flatten_matrices_1): Likewise. * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise. * expr.c (is_aligning_offset): Likewise. * tree-ssa-alias.c (is_escape_site): Likewise. * tree-stdarg.c (va_list_counter_bump, check_va_list_escapes) (check_all_va_list_escapes): Likewise. * tree-ssa-loop-ivopts.c (determine_base_object) (determine_common_wider_type): Likewise. * dojump.c (do_jump): Likewise. * tree-ssa-sccvn.c (simplify_unary_expression): Likewise. * tree-gimple.c (is_gimple_cast): Likewise. * fold-const.c (decode_field_reference, ) (fold_sign_changed_comparison, fold_unary, fold_comparison) (fold_binary): Likewise. * tree-ssa-alias-warnings.c (find_alias_site_helper) (already_warned_in_frontend_p): Likewise. * builtins.c (get_memory_rtx, fold_builtin_next_arg): Likewise. * tree.c (really_constant_p, get_unwidened): Likewise. * tree-ssa-loop-niter.c (expand_simple_operations): Likewise. * tree-ssa-loop-im.c (rewrite_bittest): Likewise. * tree-vrp.c (register_edge_assert_for_2, register_edge_assert_for_1): Likewise. * tree.h (STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS): Use CONVERT_EXPR_P. (CONVERT_EXPR_P): Define. (CASE_CONVERT): Define. From-SVN: r135114
2008-05-08re PR middle-end/36172 (ice for legal code with -O3)Richard Guenther1-2/+5
2008-05-08 Richard Guenther <rguenther@suse.de> PR middle-end/36172 * fold-const.c (operand_equal_p): Two objects which types differ in pointerness are not equal. * gcc.c-torture/compile/pr36172.c: New testcase. From-SVN: r135070
2008-05-07re PR middle-end/36137 (gcc can't do math)Jakub Jelinek1-3/+4
PR middle-end/36137 * fold-const.c (fold_binary): Use STRIP_SIGN_NOPS instead of STRIP_NOPS on arguments even for MIN_EXPR and MAX_EXPR. * gcc.c-torture/execute/20080506-1.c: New test. From-SVN: r135028
2008-04-29re PR tree-optimization/15255 ([tree-ssa] a * 2 + a * 2 is not converted to ↵Richard Guenther1-0/+11
a * 4) 2008-04-29 Richard Guenther <rguenther@suse.de> PR middle-end/15255 * fold-const.c (fold_binary): Fold (A + A) * C to A * 2*C. * gcc.dg/fold-plusmult.c: New testcase. From-SVN: r134798
2008-04-29re PR middle-end/36077 (Expressions result is wrong)Richard Guenther1-2/+7
2008-04-29 Richard Guenther <rguenther@suse.de> PR middle-end/36077 * fold-const.c (extract_muldiv_1): In combining division constants make sure to never overflow. * gcc.c-torture/execute/pr36077.c: New testcase. From-SVN: r134792
2008-04-24re PR tree-optimization/36008 (Function produces wrong results when inlined.)Jakub Jelinek1-1/+1
PR tree-optimization/36008 * fold-const.c (try_move_mult_to_index): If s == NULL, divide the original op1, rather than delta by step. * gcc.c-torture/execute/20080424-1.c: New test. From-SVN: r134634
2008-04-22fold-const.c (pointer_may_wrap_p): Call int_size_in_bytes rather than ↵Ian Lance Taylor1-23/+19
size_in_bytes. ./: * fold-const.c (pointer_may_wrap_p): Call int_size_in_bytes rather than size_in_bytes. testsuite/: * gcc.c-torture/compile/20080419-1.c: New test. From-SVN: r134566
2008-04-18fold-const.c (pointer_may_wrap_p): New static function.Ian Lance Taylor1-4/+81
* fold-const.c (pointer_may_wrap_p): New static function. (fold_comparison): Add another test for pointer overflow. Use pointer_may_wrap_p to disable some false positives. From-SVN: r134440
2008-04-17tree-vn.c (expressions_equal_p): Do not check type equality or compatibility ↵Richard Guenther1-0/+5
before calling operand_equal_p. 2008-04-17 Richard Guenther <rguenther@suse.de> * tree-vn.c (expressions_equal_p): Do not check type equality or compatibility before calling operand_equal_p. * fold-const.c (operand_equal_p): Check equivalence of integer constants before bailing out due to signedness or precision differences. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ignore spurious differences in type qualification. Ignore types for COMPONENT_REFs at all. * gcc.dg/tree-ssa/ssa-fre-17.c: New testcase. From-SVN: r134384
2008-04-15tree-const.c (tree_call_nonnegative_warnv_p): Remove local variable arg1.Rafael Avila de Espindola1-6/+3
2008-04-15 Rafael Espindola <espindola@google.com> * gcc/tree-const.c (tree_call_nonnegative_warnv_p): Remove local variable arg1. From-SVN: r134315
2008-04-15* fold-const.c (fold_overflow_warning): Remove assertion.Ian Lance Taylor1-1/+0
From-SVN: r134307
2008-04-14flags.h (POINTER_TYPE_OVERFLOW_UNDEFINED): Define.Ian Lance Taylor1-2/+10
gcc/: * flags.h (POINTER_TYPE_OVERFLOW_UNDEFINED): Define. * fold-const.c (fold_comparison): If appropriate, test POINTER_TYPE_OVERFLOW_UNDEFINED, and issue an overflow warning. (fold_binary): Test POINTER_TYPE_OVERFLOW_UNDEFINED when reassociating a pointer type. * doc/invoke.texi (Optimize Options): Document that -fstrict-overflow applies to pointer wraparound. gcc/testsuite/: * gcc.dg/strict-overflow-6.c: New. * gcc.dg/no-strict-overflow-7.c: New. * gcc.dg/Wstrict-overflow-22.c: New. From-SVN: r134287
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