aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-20re PR tree-optimization/82603 (ICE in ifcvt_local_dce w/ -O2 ↵Richard Biener1-1/+2
-ftree-loop-vectorize) 2017-10-20 Richard Biener <rguenther@suse.de> PR tree-optimization/82603 * tree-if-conv.c (predicate_mem_writes): Make sure to only remove false predicated stores. * gcc.dg/torture/pr82603.c: New testcase. From-SVN: r253933
2017-09-22re PR tree-optimization/82291 (wrong code at -O3 on x86_64-linux-gnu)Richard Biener1-90/+100
2017-09-22 Richard Biener <rguenther@suse.de> PR tree-optimization/82291 * tree-if-conv.c (predicate_mem_writes): Make sure to remove writes in blocks predicated with false. * gcc.dg/torture/pr82291.c: New testcase. From-SVN: r253093
2017-08-30[18/77] Make int_mode_for_mode return an opt_scalar_int_modeRichard Sandiford1-2/+1
Also use int_mode_for_mode instead of (int_)mode_for_size in cases where the requested size was the bitsize of an existing mode. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (opt_mode::else_blk): New function. (int_mode_for_mode): Declare. * stor-layout.c (int_mode_for_mode): Return an opt_scalar_int_mode. * builtins.c (expand_builtin_signbit): Adjust for new int_mode_for_mode return type. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (gen_lowpart_or_truncate): Likewise. (gen_lowpart_for_combine): Likewise. * config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Likewise. * config/avr/avr.c (avr_to_int_mode): Likewise. (avr_out_plus_1): Likewise. (avr_out_plus): Likewise. (avr_out_round): Likewise. * config/i386/i386.c (ix86_split_to_parts): Likewise. * config/s390/s390.c (s390_expand_vec_compare_cc): Likewise. (s390_expand_vcond): Likewise. * config/spu/spu.c (spu_split_immediate): Likewise. (spu_expand_mov): Likewise. * dse.c (get_stored_val): Likewise. * expmed.c (store_bit_field_1): Likewise. (convert_extracted_bit_field): Use int_mode_for_mode instead of int_mode_for_size. (extract_bit_field_1): Adjust for new int_mode_for_mode return type. (extract_low_bits): Likewise. * expr.c (emit_group_load_1): Likewise. Separate out the BLKmode handling rather than repeating the check. (emit_group_store): Likewise. (emit_move_via_integer): Adjust for new int_mode_for_mode return type. * optabs.c (expand_absneg_bit): Likewise. (expand_copysign_absneg): Likewise. (expand_copysign_bit): Likewise. * tree-if-conv.c (ifcvt_can_use_mask_load_store): Likewise. * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise. * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise. * var-tracking.c (prepare_call_arguments): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_do_expand_vec_perm): Use int_mode_for_mode instead of mode_for_size. * config/rs6000/rs6000.c (rs6000_do_expand_vec_perm): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251470
2017-08-29Set the call nothrow flag more oftenRichard Sandiford1-1/+2
This patch sets the nothrow flag for various calls to internal functions that are not inherently NOTHROW (and so can't be declared that way in internal-fn.def) but that are used in contexts that can guarantee NOTHROWness. 2017-08-29 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * gimplify.c (gimplify_call_expr): Copy the nothrow flag to calls to internal functions. (gimplify_modify_expr): Likewise. * tree-call-cdce.c (use_internal_fn): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise. (convert_to_divmod): Set the nothrow flag. * tree-if-conv.c (predicate_mem_writes): Likewise. * tree-vect-stmts.c (vectorizable_mask_load_store): Likewise. (vectorizable_call): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Likewise. (vect_recog_mask_conversion_pattern): Likewise. From-SVN: r251401
2017-07-03Rename DR_ALIGNED_TO to DR_OFFSET_ALIGNMENTRichard Sandiford1-5/+2
This patch renames DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT, to avoid confusion with the upcoming DR_BASE_ALIGNMENT. Nothing needed the value as a tree, and the value is clipped to BIGGEST_ALIGNMENT (maybe it should be MAX_OFILE_ALIGNMENT?) so we might as well use an unsigned int instead. 2017-07-03 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * tree-data-ref.h (innermost_loop_behavior): Replace aligned_to with offset_alignment. (DR_ALIGNED_TO): Delete. (DR_OFFSET_ALIGNMENT): New macro. * tree-vectorizer.h (STMT_VINFO_DR_ALIGNED_TO): Delete. (STMT_VINFO_DR_OFFSET_ALIGNMENT): New macro. * tree-data-ref.c (dr_analyze_innermost): Update after above changes. (create_data_ref): Likewise. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise. (vect_analyze_data_refs): Likewise. * tree-if-conv.c (if_convertible_loop_p_1): Use memset before creating dummy innermost behavior. From-SVN: r249914
2017-07-01cfg.c (scale_bbs_frequencies): New function.Jan Hubicka1-1/+2
* cfg.c (scale_bbs_frequencies): New function. * cfg.h (scale_bbs_frequencies): Declare it. * cfgloopanal.c (single_likely_exit): Cleanup. * cfgloopmanip.c (scale_loop_frequencies): Take profile_probability as parameter. (scale_loop_profile): Likewise. (loop_version): Likewise. (create_empty_loop_on_edge): Update. * cfgloopmanip.h (scale_loop_frequencies, scale_loop_profile, scale_loop_frequencies, scale_loop_profile, loopify, loop_version): Update prototypes. * modulo-sched.c (sms_schedule): Update. * predict.c (unlikely_executed_edge_p): Also check probability. (probably_never_executed_edge_p): Fix typo. * tree-if-conv.c (version_loop_for_if_conversion): Update. * tree-parloops.c (gen_parallel_loop): Update. * tree-ssa-loop-ivcanon.c (try_peel_loop): Update. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Update. * tree-ssa-loop-split.c (split_loop): Update. * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Update. * tree-vect-loop-manip.c (vect_do_peeling): Update. (vect_loop_versioning): Update. * tree-vect-loop.c (scale_profile_for_vect_loop): Update. From-SVN: r249872
2017-07-01tree-if-conv.c (combine_blocks): Use make_single_succ_edge to keep profile ↵Jan Hubicka1-1/+1
consistent. * tree-if-conv.c (combine_blocks): Use make_single_succ_edge to keep profile consistent. From-SVN: r249870
2017-06-30tree-if-conv.c (predicate_scalar_phi): Update new_stmt if fold_stmt returned ↵Andrew Pinski1-2/+5
true. 2017-06-30 Andrew Pinski <apinski@cavium.com> * tree-if-conv.c (predicate_scalar_phi): Update new_stmt if fold_stmt returned true. 2017-06-30 Andrew Pinski <apinski@cavium.com> * gcc.dg/torture/pr81245.c: New testcase. From-SVN: r249854
2017-06-29asan.c (asan_emit_stack_protection): Update.Jan Hubicka1-1/+2
* asan.c (asan_emit_stack_protection): Update. (create_cond_insert_point): Update. * auto-profile.c (afdo_propagate_circuit): Update. * basic-block.h (struct edge_def): Turn probability to profile_probability. (EDGE_FREQUENCY): Update. * bb-reorder.c (find_traces_1_round): Update. (better_edge_p): Update. (sanitize_hot_paths): Update. * cfg.c (unchecked_make_edge): Initialize probability to uninitialized. (make_single_succ_edge): Update. (check_bb_profile): Update. (dump_edge_info): Update. (update_bb_profile_for_threading): Update. * cfganal.c (connect_infinite_loops_to_exit): Initialize new edge probabilitycount to 0. * cfgbuild.c (compute_outgoing_frequencies): Update. * cfgcleanup.c (try_forward_edges): Update. (outgoing_edges_match): Update. (try_crossjump_to_edge): Update. * cfgexpand.c (expand_gimple_cond): Update make_single_succ_edge. (expand_gimple_tailcall): Update. (construct_init_block): Use make_single_succ_edge. (construct_exit_block): Use make_single_succ_edge. * cfghooks.c (verify_flow_info): Update. (redirect_edge_succ_nodup): Update. (split_edge): Update. (account_profile_record): Update. * cfgloopanal.c (single_likely_exit): Update. * cfgloopmanip.c (scale_loop_profile): Update. (set_zero_probability): Remove. (duplicate_loop_to_header_edge): Update. * cfgloopmanip.h (loop_version): Update prototype. * cfgrtl.c (try_redirect_by_replacing_jump): Update. (force_nonfallthru_and_redirect): Update. (update_br_prob_note): Update. (rtl_verify_edges): Update. (purge_dead_edges): Update. (rtl_lv_add_condition_to_bb): Update. * cgraph.c: (cgraph_edge::redirect_call_stmt_to_calle): Update. * cgraphunit.c (init_lowered_empty_function): Update. (cgraph_node::expand_thunk): Update. * cilk-common.c: Include profile-count.h * dojump.c (inv): Remove. (jumpifnot): Update. (jumpifnot_1): Update. (do_jump_1): Update. (do_jump): Update. (do_jump_by_parts_greater_rtx): Update. (do_compare_rtx_and_jump): Update. * dojump.h (jumpifnot, jumpifnot_1, jumpif_1, jumpif, do_jump, do_jump_1. do_compare_rtx_and_jump): Update prototype. * dwarf2cfi.c: Include profile-count.h * except.c (dw2_build_landing_pads): Use make_single_succ_edge. (sjlj_emit_dispatch_table): Likewise. * explow.c: Include profile-count.h * expmed.c (emit_store_flag_force): Update. (do_cmp_and_jump): Update. * expr.c (compare_by_pieces_d::generate): Update. (compare_by_pieces_d::finish_mode): Update. (emit_block_move_via_loop): Update. (store_expr_with_bounds): Update. (store_constructor): Update. (expand_expr_real_2): Update. (expand_expr_real_1): Update. * expr.h (try_casesi, try_tablejump): Update prototypes. * gimple-pretty-print.c (dump_probability): Update. (dump_profile): New. (dump_gimple_label): Update. (dump_gimple_bb_header): Update. * graph.c (draw_cfg_node_succ_edges): Update. * hsa-gen.c (convert_switch_statements): Update. * ifcvt.c (cheap_bb_rtx_cost_p): Update. (find_if_case_1): Update. (find_if_case_2): Update. * internal-fn.c (expand_arith_overflow_result_store): Update. (expand_addsub_overflow): Update. (expand_neg_overflow): Update. (expand_mul_overflow): Update. (expand_vector_ubsan_overflow): Update. * ipa-cp.c (good_cloning_opportunity_p): Update. * ipa-split.c (split_function): Use make_single_succ_edge. * ipa-utils.c (ipa_merge_profiles): Update. * loop-doloop.c (add_test): Update. (doloop_modify): Update. * loop-unroll.c (compare_and_jump_seq): Update. (unroll_loop_runtime_iterations): Update. * lra-constraints.c (lra_inheritance): Update. * lto-streamer-in.c (input_cfg): Update. * lto-streamer-out.c (output_cfg): Update. * mcf.c (adjust_cfg_counts): Update. * modulo-sched.c (sms_schedule): Update. * omp-expand.c (expand_omp_for_init_counts): Update. (extract_omp_for_update_vars): Update. (expand_omp_ordered_sink): Update. (expand_omp_for_ordered_loops): Update. (expand_omp_for_generic): Update. (expand_omp_for_static_nochunk): Update. (expand_omp_for_static_chunk): Update. (expand_cilk_for): Update. (expand_omp_simd): Update. (expand_omp_taskloop_for_outer): Update. (expand_omp_taskloop_for_inner): Update. * omp-simd-clone.c (simd_clone_adjust): Update. * optabs.c (expand_doubleword_shift): Update. (expand_abs): Update. (emit_cmp_and_jump_insn_1): Update. (expand_compare_and_swap_loop): Update. * optabs.h (emit_cmp_and_jump_insns): Update prototype. * predict.c (predictable_edge_p): Update. (edge_probability_reliable_p): Update. (set_even_probabilities): Update. (combine_predictions_for_insn): Update. (combine_predictions_for_bb): Update. (propagate_freq): Update. (estimate_bb_frequencies): Update. (force_edge_cold): Update. * profile-count.c (profile_count::dump): Add missing space into dump. (profile_count::debug): Add newline. (profile_count::differs_from_p): Explicitly convert to unsigned. (profile_count::stream_in): Update. (profile_probability::dump): New member function. (profile_probability::debug): New member function. (profile_probability::differs_from_p): New member function. (profile_probability::differs_lot_from_p): New member function. (profile_probability::stream_in): New member function. (profile_probability::stream_out): New member function. * profile-count.h (profile_count_quality): Rename to ... (profile_quality): ... this one. (profile_probability): New. (profile_count): Update. * profile.c (compute_branch_probabilities): Update. * recog.c (peep2_attempt): Update. * sched-ebb.c (schedule_ebbs): Update. * sched-rgn.c (find_single_block_region): Update. (compute_dom_prob_ps): Update. (schedule_region): Update. * sel-sched-ir.c (compute_succs_info): Update. * stmt.c (struct case_node): Update. (do_jump_if_equal): Update. (get_outgoing_edge_probs): Update. (conditional_probability): Update. (emit_case_dispatch_table): Update. (expand_case): Update. (expand_sjlj_dispatch_table): Update. (emit_case_nodes): Update. * targhooks.c: Update. * tracer.c (better_p): Update. (find_best_successor): Update. * trans-mem.c (expand_transaction): Update. * tree-call-cdce.c: Update. * tree-cfg.c (gimple_split_edge): Upate. (move_sese_region_to_fn): Upate. * tree-cfgcleanup.c (cleanup_control_expr_graph): Upate. * tree-eh.c (lower_resx): Upate. (cleanup_empty_eh_move_lp): Upate. * tree-if-conv.c (version_loop_for_if_conversion): Update. * tree-inline.c (copy_edges_for_bb): Update. (copy_cfg_body): Update. * tree-parloops.c (gen_parallel_loop): Update. * tree-profile.c (gimple_gen_ic_func_profiler): Update. (gimple_gen_time_profiler): Update. * tree-ssa-dce.c (remove_dead_stmt): Update. * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Update. * tree-ssa-loop-im.c (execute_sm_if_changed): Update. * tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Update. (unloop_loops): Update. (try_peel_loop): Update. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Update. * tree-ssa-loop-split.c (connect_loops): Update. (split_loop): Update. * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Update. (hoist_guard): Update. * tree-ssa-phionlycprop.c (propagate_rhs_into_lhs): Update. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update. (value_replacement): Update. * tree-ssa-reassoc.c (branch_fixup): Update. * tree-ssa-tail-merge.c (replace_block_by): Update. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Update. (create_edge_and_update_destination_phis): Update. (compute_path_counts): Update. (recompute_probabilities): Update. (update_joiner_offpath_counts): Update. (freqs_to_counts_path): Update. (duplicate_thread_path): Update. * tree-switch-conversion.c (hoist_edge_and_branch_if_true): Update. (struct switch_conv_info): Update. (gen_inbound_check): Update. * tree-vect-loop-manip.c (slpeel_add_loop_guard): Update. (vect_do_peeling): Update. (vect_loop_versioning): Update. * tree-vect-loop.c (scale_profile_for_vect_loop): Update. (optimize_mask_stores): Update. * ubsan.c (ubsan_expand_null_ifn): Update. * value-prof.c (gimple_divmod_fixed_value): Update. (gimple_divmod_fixed_value_transform): Update. (gimple_mod_pow2): Update. (gimple_mod_pow2_value_transform): Update. (gimple_mod_subtract): Update. (gimple_mod_subtract_transform): Update. (gimple_ic): Update. (gimple_stringop_fixed_value): Update. (gimple_stringops_transform): Update. * value-prof.h: Update. From-SVN: r249800
2017-02-05re PR tree-optimization/79347 (vect_do_peeling is messing up profile)Jan Hubicka1-2/+8
PR tree-ssa/79347 * cfgloopmanip.c (lv_adjust_loop_entry_edge, loop_version): Add ELSE_PROB. * cfgloopmanip.h (loop_version): Update prototype. * modulo-sched.c (sms_schedule): Update call of loop_version. * tree-if-conv.c(version_loop_for_if_conversion): Likewise. * tree-parloops.c (gen_parallel_loop): Likewise. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Likewise. * tree-ssa-loop-split.c (split_loop): Likewise. * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Likewise. * tree-vect-loop-manip.c (vect_loop_versioning): Likewise. * gcc.dg/tree-ssa/ifc-10.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-11.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-12.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-20040816-1.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-20040816-2.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-5.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-8.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-9.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-cd.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr56541.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr68583.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr69489-1.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr69489-2.c: Match for profile mismatches. From-SVN: r245196
2017-01-09re PR tree-optimization/78899 (Vestorized loop with optmized mask stores ↵Jakub Jelinek1-5/+37
motion is completely deleted after r242520.) PR tree-optimization/78899 * tree-if-conv.c (version_loop_for_if_conversion): Instead of returning bool return struct loop *, NULL for failure and the new loop on success. (versionable_outer_loop_p): Don't version outer loop if it has dont_vectorized bit set. (tree_if_conversion): When versioning outer loop, ensure tree_if_conversion is performed also on the inner loop of the non-vectorizable outer loop copy. * tree-vectorizer.c (set_uid_loop_bbs): Formatting fix. Fold LOOP_VECTORIZED in inner loop of the scalar outer loop and prevent vectorization of it. (vectorize_loops): For outer + inner LOOP_VECTORIZED, ensure the outer loop vectorization of the non-scalar version is attempted before vectorization of the inner loop in scalar version. If outer LOOP_VECTORIZED guarded loop is not vectorized, prevent vectorization of its inner loop. * tree-vect-loop-manip.c (rename_variables_in_bb): If outer_loop has 2 inner loops, rename also on edges from bb whose single pred is outer_loop->header. Fix typo in function comment. * gcc.target/i386/pr78899.c: New test. * gcc.dg/pr71077.c: New test. From-SVN: r244238
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-11-23fold-const.c (fold_cond_expr_with_comparison): Move simplification for A cmp ↵Bin Cheng1-0/+10
C1 ? A : C2 to below, also simplify remaining code. * fold-const.c (fold_cond_expr_with_comparison): Move simplification for A cmp C1 ? A : C2 to below, also simplify remaining code. * match.pd: Move and extend simplification from above to here: (cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)). * tree-if-conv.c (ifcvt_follow_ssa_use_edges): New func. (predicate_scalar_phi): Call fold_stmt using the new valueize func. gcc/testsuite * gcc.dg/fold-cond_expr-1.c: New test. * gcc.dg/fold-condcmpconv-1.c: New test. * gcc.dg/fold-condcmpconv-2.c: New test. From-SVN: r242750
2016-11-22re PR middle-end/78445 (ICE in maybe_gen_insn, at optabs.c:7014)Jakub Jelinek1-9/+14
PR tree-optimization/78445 * tree-if-conv.c (tree_if_conversion): If any_pred_load_store or any_complicated_phi, version loop even if flag_tree_loop_if_convert is 1. Formatting fix. * gcc.dg/pr78445.c: New test. From-SVN: r242689
2016-11-21re PR tree-optimization/78413 (ICE in single_pred_edge, at basic-block.h:361)Bill Schmidt1-1/+5
[gcc] 2016-11-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/78413 * tree-if-conv.c (versionable_outer_loop_p): Require that both inner and outer loop latches have single predecessors. [gcc/testsuite] 2016-11-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/78413 * gcc.dg/tree-ssa/pr78413.c: New test. From-SVN: r242661
2016-11-17re PR tree-optimization/77848 (Gimple if-conversion results in redundant ↵Bill Schmidt1-4/+6
comparisons) [gcc] 2016-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Richard Biener <rguenther@suse.de> PR tree-optimization/77848 * tree-if-conv.c (tree_if_conversion): Always version loops unless the user specified -ftree-loop-if-convert. [gcc/testsuite] 2016-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Richard Biener <rguenther@suse.de> PR tree-optimization/77848 * gfortran.dg/vect/pr77848.f: New test. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r242550
2016-11-17common.opt (ftree-loop-if-convert-stores): Mark as preserved for backward ↵Richard Biener1-3/+1
compatibility. 2016-11-17 Richard Biener <rguenther@suse.de> * common.opt (ftree-loop-if-convert-stores): Mark as preserved for backward compatibility. * doc/invoke.texi (ftree-loop-if-convert-stores): Remove. * tree-if-conv.c (pass_if_conversion::gate): Do not test flag_tree_loop_if_convert_stores. (pass_if_conversion::execute): Likewise. From-SVN: r242542
2016-11-16Commentary correctionsWilliam Schmidt1-6/+3
From-SVN: r242521
2016-11-16re PR tree-optimization/77848 (Gimple if-conversion results in redundant ↵Bill Schmidt1-4/+48
comparisons) 2016-11-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/77848 * tree-if-conv.c (version_loop_for_if_conversion): When versioning an outer loop, only save basic block aux information for the inner loop. (versionable_outer_loop_p): New function. (tree_if_conversion): Version the outer loop instead of the inner one if the pattern will be recognized for outer-loop vectorization. From-SVN: r242520
2016-11-16Support non-masked epilogue vectoriziationYuri Rumyantsev1-1/+1
gcc/ 2016-11-16 Yuri Rumyantsev <ysrumyan@gmail.com> * params.def (PARAM_VECT_EPILOGUES_NOMASK): New. * tree-if-conv.c (tree_if_conversion): Make public. * * tree-if-conv.h: New file. * tree-vect-data-refs.c (vect_analyze_data_ref_dependences) Avoid dynamic alias checks for epilogues. * tree-vect-loop-manip.c (vect_do_peeling): Return created epilog. * tree-vect-loop.c: include tree-if-conv.h. (new_loop_vec_info): Add zeroing orig_loop_info field. (vect_analyze_loop_2): Don't try to enhance alignment for epilogues. (vect_analyze_loop): Add argument ORIG_LOOP_INFO which is not NULL if epilogue is vectorized, set up orig_loop_info field of loop_vinfo using passed argument. (vect_transform_loop): Check if created epilogue should be returned for further vectorization with less vf. If-convert epilogue if required. Print vectorization success for epilogue. * tree-vectorizer.c (vectorize_loops): Add epilogue vectorization if it is required, pass loop_vinfo produced during vectorization of loop body to vect_analyze_loop. * tree-vectorizer.h (struct _loop_vec_info): Add new field orig_loop_info. (LOOP_VINFO_ORIG_LOOP_INFO): New. (LOOP_VINFO_EPILOGUE_P): New. (LOOP_VINFO_ORIG_VECT_FACTOR): New. (vect_do_peeling): Change prototype to return epilogue. (vect_analyze_loop): Add argument of loop_vec_info type. (vect_transform_loop): Return created loop. gcc/testsuite/ 2016-11-16 Yuri Rumyantsev <ysrumyan@gmail.com> * lib/target-supports.exp (check_avx2_hw_available): New. (check_effective_target_avx2_runtime): New. * gcc.dg/vect/vect-tail-nomask-1.c: New test. From-SVN: r242501
2016-10-17Update dom_infoYuri Rumyantsev1-12/+41
2016-10-17 Yuri Rumyantsev <ysrumyan@gmail.com> * dominance.c (dom_info::dom_info): Add new constructor for region which is vector of basic blocks. (dom_init): New method to initialize members common for both constructors. (dom_info::dom_info): Invoke dom_init for partial initialization. (dom_info::get_idom): Add check to corner cases on basic blocks which are not in region. (dom_info::calc_dfs_tree): Check M_FAKE_EXIT_EDGE instead of M_REVERSE to detect unreachable bbs. (dom_info::calc_idoms): Likewise. (compute_dom_fast_query_in_region): New function. (calculate_dominance_info_for_region): Likewise. (free_dominance_info_for_region): Likewise. * dominance.h: Add prototypes for introduced region-based functions tree-if-conv.c: (build_region): New function. (if_convertible_loop_p_1): Invoke local version of post-dominators calculation before basic block predication with subsequent freeing post-dominator info. (tree_if_conversion): Remove free of post-dominator info (pass_if_conversion::execute): Delete detection of infinite loops and fake edges to exit block since post-dominator calculation is performed per if-converted loop only. From-SVN: r241275
2016-09-27auto-inc-dec.c (try_merge): Remove break after return.Jakub Jelinek1-1/+0
* auto-inc-dec.c (try_merge): Remove break after return. * cselib.c (autoinc_split): Likewise. * explow.c (promote_mode): Likewise. * fixed-value.c (fixed_arithmetic): Likewise. * hsa.c (hsa_internal_fn::get_arity): Likewise. * rtlanal.c (modified_between_p, modified_in_p): Likewise. * trans-mem.c (get_attrs_for): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-vrp.c (simplify_stmt_using_ranges): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_fold_builtin): Likewise. * config/aarch64/aarch64.c (aarch64_get_condition_code_1): Likewise. * config/c6x/c6x.c (c6x_get_unit_specifier): Likewise. * config/cr16/cr16.c (legitimate_pic_operand_p): Likewise. * config/cris/cris.c (cris_op_str): Likewise. * config/mn10300/mn10300.c (cc_flags_for_code): Likewise. * config/tilepro/tilepro.c (tilepro_emit_setcc_internal_di): Likewise. c-family/ * c-ada-spec.c (print_ada_declaration): Remove break after return. objc/ * objc-act.c (continue_class): Remove break after return. (objc_maybe_printable_name): Likewise. fortran/ * dependency.c (gfc_dep_compare_expr): Remove break after return. * frontend-passes.c (optimize_op): Likewise. * interface.c (gfc_current_interface_head): Likewise. * symbol.c (check_conflict): Likewise. * trans-intrinsic.c (build_fix_expr): Likewise. ada/ * terminals.c (is_gui_app): Remove break after return. From-SVN: r240554
2016-08-18ssa-iterators.h (ssa_vuse_operand): New inline.Richard Biener1-14/+84
2016-08-18 Richard Biener <rguenther@suse.de> * ssa-iterators.h (ssa_vuse_operand): New inline. * tree-if-conv.c (ifc_temp_var): Update virtual operand. (predicate_all_scalar_phis): Use remove_phi_node to remove phi nodes predicated. Delay removing virtual PHIs. (predicate_mem_writes): Update virtual operands. (combine_blocks): Likewise. Propagate out remaining virtual PHIs. (tree_if_conversion): Do not rewrite virtual SSA form. * tree-phinodes.c (release_phi_node): Make static. * tree-phinodes.h (release_phi_node): Remove. From-SVN: r239560
2016-07-20re PR tree-optimization/71503 (gcc ICE at -O3 on valid code on ↵Bin Cheng1-1/+4
x86_64-linux-gnu in "gen_phi_arg_condition") PR tree-optimization/71503 PR tree-optimization/71683 * tree-if-conv.c (gen_phi_arg_condition): Record true predicate and break. gcc/testsuite PR tree-optimization/71503 PR tree-optimization/71683 * gcc.dg/tree-ssa/ifc-pr71503.c: New test. * gcc.dg/tree-ssa/ifc-pr71683.c: New test. From-SVN: r238512
2016-06-01re PR tree-optimization/71261 (Trunk GCC hangs on knl and broadwell targets)Richard Biener1-191/+1
2016-06-01 Richard Biener <rguenther@suse.de> PR tree-optimization/71261 * tree-vect-patterns.c (check_bool_pattern): Gather a hash-set of stmts successfully put in the bool pattern. Remove single-use restriction. (adjust_bool_pattern_cast): Add cast at the use site via the pattern def sequence. (adjust_bool_pattern): Remove recursion, maintain a hash-map of patterned defs. Use the pattern def seqence instead of multiple independent patterns. (sort_after_uid): New qsort compare function. (adjust_bool_stmts): New function to process stmts in the bool pattern in IL order. (vect_recog_bool_pattern): Adjust. * tree-if-conv.c (ifcvt_split_def_stmt): Remove. (ifcvt_walk_pattern_tree): Likewise. (stmt_is_root_of_bool_pattern): Likewise. (ifcvt_repair_bool_pattern): Likewise. (tree_if_conversion): Do not call ifcvt_repair_bool_pattern. * gcc.dg/torture/vect-bool-1.c: New testcase. From-SVN: r236989
2016-05-25re PR tree-optimization/71261 (Trunk GCC hangs on knl and broadwell targets)Richard Biener1-3/+3
2016-05-25 Richard Biener <rguenther@suse.de> PR tree-optimization/71261 * tree-if-conv.c (ifcvt_split_def_stmt): Walk uses on the interesting stmt instead of immediate uses when looking for the use operand to replace. * c-c++-common/torture/pr71261.c: New testcase. From-SVN: r236701
2016-05-25timevar.def (TV_TREE_LOOP_IFCVT): Add.Richard Biener1-1/+1
2016-05-25 Richard Biener <rguenther@suse.de> * timevar.def (TV_TREE_LOOP_IFCVT): Add. * tree-if-conv.c (pass_data_if_conversion): Use it. From-SVN: r236695
2016-05-20tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use ↵Richard Biener1-9/+16
gimple_seq_add_seq_without_update. 2016-05-20 Richard Biener <rguenther@suse.de> * tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use gimple_seq_add_seq_without_update. (release_bb_predicate): Assert we have no operands to free. (if_convertible_loop_p_1): Calculate post dominators later. Do not free BB predicates here. (combine_blocks): Do not recompute BB predicates. (version_loop_for_if_conversion): Save BB predicates around loop versioning. * gcc.dg/tree-ssa/ifc-cd.c: Adjust. From-SVN: r236498
2016-05-19Fix memory leak in tree-if-conv.cMartin Liska1-2/+2
* tree-if-conv.c (ifcvt_repair_bool_pattern): Utilize auto_vecs. From-SVN: r236470
2016-05-09tree-if-conv.c (tree-ssa-loop.h): Include header file.Bin Cheng1-11/+112
* tree-if-conv.c (tree-ssa-loop.h): Include header file. (tree-ssa-loop-niter.h): Ditto. (idx_within_array_bound, ref_within_array_bound): New functions. (ifcvt_memrefs_wont_trap): Check if array ref is within bound. Factor out check on writable base object to ... (base_object_writable): ... here. gcc/testsuite/ * gcc.dg/tree-ssa/ifc-9.c: New test. * gcc.dg/tree-ssa/ifc-10.c: New test. * gcc.dg/tree-ssa/ifc-11.c: New test. * gcc.dg/tree-ssa/ifc-12.c: New test. * gcc.dg/vect/pr61194.c: Remove XFAIL. * gcc.dg/vect/vect-23.c: Remove XFAIL. * gcc.dg/vect/vect-mask-store-move-1.c: Revise test check. From-SVN: r236026
2016-05-06Fix memory leak in tree-if-conv.cMartin Liska1-2/+1
* tree-if-conv.c (ifcvt_split_critical_edges): Use auto_vec instead of vec as the vector is local to the function. From-SVN: r235974
2016-05-06re PR tree-optimization/70960 (ICE: tree check: expected ssa_name, have ↵Richard Biener1-0/+3
integer_cst in ifcvt_walk_pattern_tree, at tree-if-conv.c:2465) 2016-05-06 Richard Biener <rguenther@suse.de> PR tree-optimization/70960 * tree-if-conv.c (ifcvt_walk_pattern_tree): Handle non-SSA ops. * gfortran.fortran-torture/compile/pr70960.f90: New testcase. From-SVN: r235953
2016-05-03re PR tree-optimization/70916 (gcc ICE at -O3 on valid code on ↵Jakub Jelinek1-0/+11
x86_64-linux-gnu in "tree_operand_check") PR tree-optimization/70916 * tree-if-conv.c: Include cfganal.h. (pass_if_conversion::execute): Call connect_infinite_loops_to_exit and remove_fake_exit_edges around the optimization pass. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r235842
2016-05-03re PR tree-optimization/70916 (gcc ICE at -O3 on valid code on ↵Jakub Jelinek1-24/+4
x86_64-linux-gnu in "tree_operand_check") PR tree-optimization/70916 * tree-if-conv.c (constant_or_ssa_name): Removed. (fold_build_cond_expr): Use is_gimple_val instead of constant_or_ssa_name. From-SVN: r235815
2016-05-03re PR tree-optimization/56541 (vectorizaton fails in conditional assignment ↵Bin Cheng1-61/+70
of a constant) PR tree-optimization/56541 * doc/invoke.texi (@item max-tree-if-conversion-phi-args): New item. * params.def (PARAM_MAX_TREE_IF_CONVERSION_PHI_ARGS): new param. * tree-if-conv.c (MAX_PHI_ARG_NUM): new macro. (any_complicated_phi): new static variable. (aggressive_if_conv): delete. (if_convertible_phi_p): support phis with more than two arguments. (if_convertible_bb_p): remvoe check on aggressive_if_conv and critical pred edges. (ifcvt_split_critical_edges): support phis with more than two arguments by checking new parameter. only split critical edges if needed. (tree_if_conversion): handle simd pragma marked loop using new local variable aggressive_if_conv. check any_complicated_phi. gcc/testsuite PR tree-optimization/56541 * gcc.dg/tree-ssa/ifc-pr56541.c: new test. * gcc.dg/vect/pr56541.c: new test. From-SVN: r235808
2016-04-26tree-if-conv.c (any_pred_load_store): New static variable.Bin Cheng1-25/+23
* tree-if-conv.c (any_pred_load_store): New static variable. (if_convertible_gimple_assign_stmt_p): Remove parameter. Use any_pred_load_store instead of and_mask_load_store. (if_convertible_stmt_p, if_convertible_loop_p_1): Ditto. (if_convertible_loop_p, insert_gimplified_predicates): Ditto. (combine_blocks, tree_if_conversion): Ditto. From-SVN: r235437
2016-04-26re PR tree-optimization/70771 (ICE on valid code at -O3 on x86_64-linux-gnu ↵Bin Cheng1-63/+10
in operator[], at vec.h:714) PR tree-optimization/70771 PR tree-optimization/70775 * tree-if-conv.c (if_convertible_phi_p): Remove check on special virtual PHI nodes. Delete parameter. (if_convertible_loop_p_1): Delete argument to above function. (predicate_all_scalar_phis): Delete code handling single-argument PHIs. (tree_if_conversion): Mark and update virtual SSA. gcc/testsuite/ChangeLog PR tree-optimization/70771 PR tree-optimization/70775 * gcc.dg/pr70771.c: New test. * gcc.dg/pr70771.c: New test. From-SVN: r235436
2016-04-21re PR tree-optimization/70725 (Internal compiler error (ICE) on valid code)Richard Biener1-10/+21
2016-04-21 Richard Biener <rguenther@suse.de> PR tree-optimization/70725 * tree-if-conv.c (if_convertible_phi_p): Adjust guard for phi_convertible_by_degenerating_args. (predicate_all_scalar_phis): Handle single-argument PHIs. From-SVN: r235341
2016-04-20re PR tree-optimization/69489 (missed vectorization for boolean loop, missed ↵Bin Cheng1-6/+62
if-conversion) PR tree-optimization/69489 * tree-if-conv.c (phi_convertible_by_degenerating_args): New. (if_convertible_phi_p): Call phi_convertible_by_degenerating_args. Revise dump message. (if_convertible_bb_p): Remove check on edge count of basic block's predecessors. gcc/testsuite/ChangeLog PR tree-optimization/69489 * gcc.dg/tree-ssa/ifc-pr69489-2.c: New test. From-SVN: r235292
2016-04-20re PR tree-optimization/56625 (After if-conversion vectorizer doesn't ↵Bin Cheng1-21/+89
recognize similar loads) PR tree-optimization/56625 PR tree-optimization/69489 * tree-data-ref.h (DR_INNERMOST): New macro. * tree-if-conv.c (innermost_loop_behavior_hash): New class for hashing struct innermost_loop_behavior. (ref_DR_map): Remove. (innermost_DR_map): New map. (baseref_DR_map): Revise comment. (hash_memrefs_baserefs_and_store_DRs_read_written_info): Store DR to innermost_DR_map accroding to its innermost loop behavior. (ifcvt_memrefs_wont_trap): Get DR from innermost_DR_map according to its innermost loop behavior. (if_convertible_loop_p_1): Remove intialization for ref_DR_map. Add initialization for innermost_DR_map. Record memory reference in DR_BASE_ADDRESS if the reference is compound one or it doesn't have innermost loop behavior. (if_convertible_loop_p): Remove release for ref_DR_map. Release innermost_DR_map. gcc/testsuite/ChangeLog PR tree-optimization/56625 PR tree-optimization/69489 * gcc.dg/vect/pr56625.c: New test. * gcc.dg/tree-ssa/ifc-pr69489-1.c: New test. From-SVN: r235289
2016-04-20tree-if-conv.c (is_false_predicate): For NULL_TREE return false rather than ↵Marek Polacek1-3/+3
true. * tree-if-conv.c (is_false_predicate): For NULL_TREE return false rather than true. From-SVN: r235272
2016-04-20re PR tree-optimization/70725 (Internal compiler error (ICE) on valid code)Marek Polacek1-1/+11
PR tree-optimization/70725 * tree-if-conv.c (is_false_predicate): New function. (predicate_mem_writes): Use it. * gcc.dg/pr70725.c: New test. From-SVN: r235250
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-12-10tree-if-conv.c: Include params.h.Richard Biener1-2/+3
2015-12-10 Richard Biener <rguenther@suse.de> * tree-if-conv.c: Include params.h. (ifcvt_memrefs_wont_trap): Use PARAM_ALLOW_STORE_DATA_RACES instead of flag_tree_loop_if_convert_stores to guard cases we'd introduce store-data-races. From-SVN: r231495
2015-12-10tree-if-conv.c (if_convertible_loop_p_1): Do not compute dependences.Richard Biener1-13/+3
2015-12-10 Richard Biener <rguenther@suse.de> * tree-if-conv.c (if_convertible_loop_p_1): Do not compute dependences. (if_convertible_loop_p): Adjust. From-SVN: r231492
2015-12-09re PR tree-optimization/68786 (Aligned masked store is generated for ↵Jakub Jelinek1-1/+3
unaligned pointer) PR tree-optimization/68786 * tree-if-conv.c: Include builtins.h. (predicate_mem_writes): Put result of get_object_alignment (ref) into second argument's value. * tree-vect-stmts.c (vectorizable_mask_load_store): Put minimum pointer alignment into second argument's value. * tree-data-ref.c (get_references_in_stmt): Use value of second argument for build_aligned_type, and only the type to build a zero second argument for MEM_REF. * internal-fn.c (expand_mask_load_optab_fn, expand_mask_store_optab_fn): Likewise. From-SVN: r231454
2015-12-09re PR tree-optimization/68583 (Missed if-conversion)Richard Biener1-34/+13
2015-12-09 Richard Biener <rguenther@suse.de> PR tree-optimization/68583 * tree-if-conv.c (if_convertible_phi_p): Drop flag_tree_loop_if_convert_stores check in favor of the existing any_mask_load_store check. (insert_gimplified_predicates): Likewise. (combine_blocks): Likewise. (tree_if_conversion): Likewise. (ifcvt_memrefs_wont_trap): Properly check flag_tree_loop_if_convert_stores in all places that can end up introducing store-data-races. (if_convertible_gimple_assign_stmt_p): Remove restriction on flag_tree_loop_if_convert_stores for stores we can if-convert without introducing store-data-races. Force versioning for all if-converted stores. * gcc.dg/tree-ssa/ifc-pr68583.c: New testcase. * gcc.dg/vect/vect-72.c: Adjust. * gcc.dg/vect/vect-cselim-2.c: Likewise. * gcc.dg/vect/vect-strided-store-a-u8-i2.c: Likewise. From-SVN: r231453
2015-12-09Fix memory leak in tree-if-conv.cMartin Liska1-1/+1
* tree-if-conv.c (ifcvt_local_dce): Replace vec with auto_vec. From-SVN: r231447
2015-12-09re PR tree-optimization/68583 (Missed if-conversion)Richard Biener1-71/+55
2015-12-09 Richard Biener <rguenther@suse.de> PR tree-optimization/68583 * tree-if-conv.c (ifc_dr): Make flags bool, add w_unconditionally flag and rename predicates to w_predicate, rw_predicate and base_w_predicate. (DR_WRITTEN_AT_LEAST_ONCE): Rename to ... (DR_BASE_W_UNCONDITIONALLY): ... this. (DR_W_UNCONDITIONALLY): Add. (hash_memrefs_baserefs_and_store_DRs_read): Adjust. Compute unconditionally written separately from read or written. (ifcvt_memrefs_wont_trap): Properly treat reads. (ifcvt_could_trap_p): Inline ... (if_convertible_gimple_assign_stmt_p): ... here. Refactor to avoid code duplication. (if_convertible_loop_p_1): Adjust and properly initialize predicates. From-SVN: r231444
2015-11-30tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field.Venkataramanan Kumar1-16/+22
2015-11-30 Venkataramanan Kumar <Venkataramanan.Kumar@amd.com> * tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field. (hash_memrefs_baserefs_and_store_DRs_read_written_info): Hash base ref, DR pairs and store base_predicate for write type DRs. (ifcvt_memrefs_wont_trap): Guard checks with -ftree-loop-if-convert-stores flag. From-SVN: r231057