aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-28tree-vect-loop.c (optimize_mask_stores): Add bb to the right loop.Bin Cheng1-2/+8
* tree-vect-loop.c (optimize_mask_stores): Add bb to the right loop. From-SVN: r246541
2017-02-27re PR tree-optimization/77536 (Vectorizer not maintaining relationship of ↵Bin Cheng1-9/+46
relative block frequencies in absence of real profile data) PR tree-optimization/77536 * tree-ssa-loop-manip.c (niter_for_unrolled_loop): New function. (tree_transform_and_unroll_loop): Use above function to compute the estimated niter of unrolled loop and use it when scaling profile. Also use count info rather than frequency if it's non-zero. * tree-ssa-loop-manip.h niter_for_unrolled_loop(): New declaration. * tree-vect-loop.c (scale_profile_for_vect_loop): New function. (vect_transform_loop): Call above function. gcc/testsuite * gcc.dg/vect/pr79347.c: Revise testing string. From-SVN: r245754
2017-02-06re PR tree-optimization/79284 (ICE on valid code at -O3 on x86_64-linux-gnu: ↵Jakub Jelinek1-8/+8
verify_gimple failed) PR tree-optimization/79284 * tree-vectorizer.h (VECT_SCALAR_BOOLEAN_TYPE_P): Define. * tree-vect-stmts.c (vect_get_vec_def_for_operand, vectorizable_mask_load_store, vectorizable_operation, vect_is_simple_cond, get_same_sized_vectype): Use it instead of comparing TREE_CODE of a type against BOOLEAN_TYPE. * tree-vect-patterns.c (check_bool_pattern, search_type_for_mask_1, vect_recog_bool_pattern, vect_recog_mask_conversion_pattern): Likewise. * tree-vect-slp.c (vect_get_constant_vectors): Likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise. Remove redundant gimple_code (stmt) == GIMPLE_ASSIGN test after is_gimple_assign (stmt). Replace another such test with is_gimple_assign (stmt). testsuite/ * gcc.c-torture/compile/pr79284.c: New test. From-SVN: r245214
2017-02-03re PR tree-optimization/79340 (Memory leaks in tree-vect-slp.c)Jakub Jelinek1-7/+11
PR tree-optimization/79340 * tree-vect-loop.c (vectorizable_reduction): Release vec_defs elements after safe_splicing them into other vectors. Formatting fixes. From-SVN: r245171
2017-02-01tree-vect-loop.c (vect_compute_single_scalar_iteration_cost): Pass stmt_info ↵Andrew Pinski1-11/+19
to record_stmt_cost. 2017-02-01 Andrew Pinski <apinski@cavium.com> * tree-vect-loop.c (vect_compute_single_scalar_iteration_cost): Pass stmt_info to record_stmt_cost. (vect_get_known_peeling_cost): Pass stmt_info if known to record_stmt_cost. * config/aarch64/aarch64-protos.h (cpu_vector_cost): Split cpu_vector_cost field into scalar_int_stmt_cost and scalar_fp_stmt_cost. Split vec_stmt_cost field into vec_int_stmt_cost and vec_fp_stmt_cost. * config/aarch64/aarch64.c (generic_vector_cost): Update for the splitting of scalar_stmt_cost and vec_stmt_cost. (thunderx_vector_cost): Likewise. (cortexa57_vector_cost): LIkewise. (exynosm1_vector_cost): Likewise. (xgene1_vector_cost): Likewise. (thunderx2t99_vector_cost): Improve after the splitting of the two fields. (aarch64_builtin_vectorization_cost): Update for the splitting of scalar_stmt_cost and vec_stmt_cost. From-SVN: r245101
2017-01-05[bootstrap-O1] add initializers to avoid warnings at -O1Alexandre Oliva1-1/+1
Building with the bootstrap-O1 configuration option fails to compile a number of files due to AFAICT false-positive warnings about uses of uninitialized variables. This patch adds dummy initializers to silence them all. for gcc/ChangeLog * multiple_target.c (create_dispatcher_calls): Init e_next. * tree-ssa-loop-split.c (split_loop): Init border. * tree-vect-loop.c (vect_determine_vectorization_factor): Init scalar_type. From-SVN: r244086
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-06re PR tree-optimization/78675 (ICE: verify_gimple failed (error: integral ↵Jakub Jelinek1-2/+4
result type precision does not match field size of BIT_FIELD_REF)) 2016-12-06 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/78675 * tree-vect-loop.c (vectorizable_live_operation): For VECTOR_BOOLEAN_TYPE_P vectype use integral type with bitsize precision instead of TREE_TYPE (vectype) for the BIT_FIELD_REF. * gcc.c-torture/execute/pr78675.c: New test. * gcc.target/i386/pr78675-1.c: New test. * gcc.target/i386/pr78675-2.c: New test. From-SVN: r243283
2016-11-16Support non-masked epilogue vectoriziationYuri Rumyantsev1-19/+83
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-11-16Fix nb_iterations_estimate calculation in tree-vect-loop.cRichard Sandiford1-20/+18
vect_transform_loop has to reduce three iteration counts by the vectorisation factor: nb_iterations_upper_bound, nb_iterations_likely_upper_bound and nb_iterations_estimate. All three are latch execution counts rather than loop body execution counts. The calculations were taking that into account for the first two, but not for nb_iterations_estimate. This patch updates the way the calculations are done to fix this and to add a bit more commentary about what is going on. gcc/ 2016-11-15 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * tree-vect-loop.c (vect_transform_loop): Protect the updates of all three iteration counts with an any_* test. Use a single update for each count. Fix the calculation of nb_iterations_estimate. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r242475
2016-11-03tree-vect-loop.c (destroy_loop_vec_info): Handle cond_expr.Bin Cheng1-23/+62
* tree-vect-loop.c (destroy_loop_vec_info): Handle cond_expr. (vect_is_simple_reduction): Swap cond_reduction by inversion. From-SVN: r241810
2016-10-13tree-vect-loop.c (loop_niters_no_overflow): New func.Bin Cheng1-2/+36
* tree-vect-loop.c (loop_niters_no_overflow): New func. (vect_transform_loop): Call loop_niters_no_overflow. Pass the no-overflow information to vect_do_peeling_for_loop_bound and vect_gen_vector_loop_niters. From-SVN: r241102
2016-10-13tree-vect-loop-manip.c (adjust_vec_debug_stmts): Don't release adjust_vec ↵Bin Cheng1-168/+23
automatically. * tree-vect-loop-manip.c (adjust_vec_debug_stmts): Don't release adjust_vec automatically. (slpeel_add_loop_guard): Remove param cond_expr_stmt_list. Rename param exit_bb to guard_to. (slpeel_checking_verify_cfg_after_peeling): (set_prologue_iterations): (create_lcssa_for_virtual_phi): New func which is factored out from slpeel_tree_peel_loop_to_edge. (slpeel_tree_peel_loop_to_edge): (iv_phi_p): New func. (vect_can_advance_ivs_p): Call iv_phi_p. (vect_update_ivs_after_vectorizer): Call iv_phi_p. Directly insert new gimple stmts in basic block. (vect_do_peeling_for_loop_bound): (vect_do_peeling_for_alignment): (vect_gen_niters_for_prolog_loop): Rename to... (vect_gen_prolog_loop_niters): ...Rename from. Change parameters and adjust implementation. (vect_update_inits_of_drs): Fix code style issue. Convert niters to sizetype if necessary. (vect_build_loop_niters): Move to here from tree-vect-loop.c. Change it to external function. (vect_gen_scalar_loop_niters, vect_gen_vector_loop_niters): New. (vect_gen_vector_loop_niters_mult_vf): New. (slpeel_update_phi_nodes_for_loops): New. (slpeel_update_phi_nodes_for_guard1): Reimplement. (find_guard_arg, slpeel_update_phi_nodes_for_guard2): Reimplement. (slpeel_update_phi_nodes_for_lcssa, vect_do_peeling): New. * tree-vect-loop.c (vect_build_loop_niters): Move to file tree-vect-loop-manip.c (vect_generate_tmps_on_preheader): Delete. (vect_transform_loop): Rename vectorization_factor to vf. Call vect_do_peeling instead of vect_do_peeling-* functions. * tree-vectorizer.h (vect_do_peeling): New decl. (vect_build_loop_niters, vect_gen_vector_loop_niters): New decls. (vect_do_peeling_for_loop_bound): Delete. (vect_do_peeling_for_alignment): Delete. From-SVN: r241099
2016-10-13tree-vect-loop.c (vect_analyze_loop_2): Check and skip loop if it has no ↵Bin Cheng1-0/+19
enough iterations for LOOP_VINFO_PEELING_FOR_GAPS. * tree-vect-loop.c (vect_analyze_loop_2): Check and skip loop if it has no enough iterations for LOOP_VINFO_PEELING_FOR_GAPS. gcc/testsuite * gcc.dg/vect/vect-98.c: Refine test case. * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Increase niters. * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto. * gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto. From-SVN: r241097
2016-10-13tree-vect-loop.c (vectorizable_live_operation): Support handling for live ↵Bin Cheng1-13/+17
variable outside loop but not in lcssa form. * tree-vect-loop.c (vectorizable_live_operation): Support handling for live variable outside loop but not in lcssa form. From-SVN: r241096
2016-09-26ipa-inline-analysis.c (find_foldable_builtin_expect): Use ↵Marek Polacek1-6/+2
gimple_call_internal_p. * ipa-inline-analysis.c (find_foldable_builtin_expect): Use gimple_call_internal_p. * ipa-split.c (find_return_bb): Likewise. (execute_split_functions): Likewise. * omp-low.c (dump_oacc_loop_part): Likewise. (oacc_loop_xform_head_tail): Likewise. * predict.c (predict_loops): Likewise. * sanopt.c (pass_sanopt::execute): Likewise. * tree-cfg.c (get_abnormal_succ_dispatcher): Likewise. * tree-parloops.c (oacc_entry_exit_ok_1): Likewise. * tree-stdarg.c (gimple_call_ifn_va_arg_p): Remove function. (expand_ifn_va_arg_1): Use gimple_call_internal_p. (expand_ifn_va_arg): Likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise. (optimize_mask_stores): Likewise. * tree-vect-stmts.c (vect_simd_lane_linear): Likewise. (vect_transform_stmt): Likewise. * tree-vectorizer.c (vect_loop_vectorized_call): Likewise. * tsan.c (instrument_memory_accesses): Likewise. From-SVN: r240498
2016-09-15re PR tree-optimization/77503 (ICE in vect_transform_stmt compiling postgresql)Bin Cheng1-7/+19
PR tree-optimization/77503 * tree-vect-loop.c (vectorizable_reduction): Record reduction code for CONST_COND_REDUCTION at analysis stage and use it at transform stage. * tree-vectorizer.h (struct _stmt_vec_info): New field. (STMT_VINFO_VEC_CONST_COND_REDUC_CODE): New macro. * tree-vect-stmts.c (new_stmt_vec_info): Initialize above new field. gcc/testsuite * gcc.dg/vect/pr77503.c: New test. From-SVN: r240166
2016-08-23re PR tree-optimization/77286 (ICE in fold_convert_loc, at fold-const.c:2248 ↵Richard Biener1-16/+33
building 435.gromacs) 2016-08-23 Richard Biener <rguenther@suse.de> PR tree-optimization/77286 * tree-vect-loop.c (vect_analyze_loop_form_1): Do not modify the CFG here. (vect_transform_loop): Split exit edges of loop and scalar loop if required and at the appropriate time. From-SVN: r239700
2016-08-17re PR tree-optimization/71752 (ICE in compute_live_loop_exits, at ↵Alan Hayward1-14/+21
tree-ssa-loop-manip.c:229 w/ -O1 -ftree-vectorize) 2015-08-17 Alan Hayward <alan.hayward@arm.com> PR tree-optimization/71752 * tree-vect-loop.c (vectorizable_reduction): Keep SLP operand ordering. * tree-vect-slp.c (vect_get_slp_defs): Handle null operands. PR tree-optimization/71752 * gcc.dg/vect/pr71752.c: New From-SVN: r239542
2016-08-12re PR tree-optimization/69848 (poor vectorization of a loop from SPEC2006 ↵Bin Cheng1-23/+69
464.h264ref) PR tree-optimization/69848 * tree-vectorizer.h (enum vect_def_type): New condition reduction type CONST_COND_REDUCTION. * tree-vect-loop.c (vectorizable_reduction): Support new condition reudction type CONST_COND_REDUCTION. gcc/testsuite PR tree-optimization/69848 * gcc.dg/vect/vect-pr69848.c: New test. From-SVN: r239416
2016-07-29re PR tree-optimization/57558 (Loop not vectorized if iteration count could ↵Bin Cheng1-32/+111
be infinite) PR tree-optimization/57558 * tree-vect-loop-manip.c (vect_create_cond_for_niters_checks): New function. (vect_loop_versioning): Support versioning with niter assumptions. * tree-vect-loop.c (tree-ssa-loop.h): Include header file. (vect_get_loop_niters): New parameter. Reimplement to support assumptions in loop niter info. (vect_analyze_loop_form_1, vect_analyze_loop_form): Ditto. (new_loop_vec_info): Init LOOP_VINFO_NITERS_ASSUMPTIONS. (vect_estimate_min_profitable_iters): Use LOOP_REQUIRES_VERSIONING. Support loop versioning for niters. * tree-vectorizer.c (tree-ssa-loop-niter.h): Include header file. (vect_free_loop_info_assumptions): New function. (vectorize_loops): Free loop niter info for loops with flag LOOP_F_ASSUMPTIONS set if vectorization failed. * tree-vectorizer.h (struct _loop_vec_info): New field num_iters_assumptions. (LOOP_VINFO_NITERS_ASSUMPTIONS): New macro. (LOOP_REQUIRES_VERSIONING_FOR_NITERS): New macro. (LOOP_REQUIRES_VERSIONING): New macro. (vect_free_loop_info_assumptions): New decl. gcc/testsuite PR tree-optimization/57558 * gcc.dg/vect/pr57558-1.c: New test. * gcc.dg/vect/pr57558-2.c: New test. From-SVN: r238877
2016-07-19tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Update comment.Ilya Enkovich1-1/+9
gcc/ * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Update comment. (vect_update_inits_of_drs): Likewise. (vect_create_cond_for_alias_checks): Likewise. * tree-vect-loop.c (vect_get_known_peeling_cost): Likewise. From-SVN: r238466
2016-07-13tree-vect-data-refs.c (vect_no_alias_p): New function.Bin Cheng1-9/+1
* tree-vect-data-refs.c (vect_no_alias_p): New function. (vect_prune_runtime_alias_test_list): Call vect_no_alias_p to resolve alias checks which are known at compilation time. Truncate vector LOOP_VINFO_MAY_ALIAS_DDRS(loop_vinfo) if all alias checks are resolved. Move dump info for too many runtime alias checks to here... * tree-vect-loop.c (vect_analyze_loop_2): ...From here. gcc/testsuite * gcc.dg/vect/vect-35-big-array.c: Refine comment and test. * gcc.dg/vect/vect-35.c: Ditto. * gcc.dg/vect/vect-alias-check-2.c: New test. From-SVN: r238301
2016-07-08re PR debug/71667 (ICE in as_a, at is-a.h:192 w/ -g -O2 -ftree-vectorize)Alan Hayward1-3/+4
2016-07-08 Alan Hayward <alan.hayward@arm.com> gcc/ PR tree-optimization/71667 * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts testsuite/ PR tree-optimization/71667 * gcc.dg/vect/pr71667.c: New From-SVN: r238160
2016-07-06[5/7] Move the fix for PR65518Richard Sandiford1-1/+3
This patch moves the fix for PR65518 to the code that checks whether load-and-permute operations are supported. If the group size is greater than the vectorisation factor, it would still be possible to fall back to elementwise loads (as for strided groups) rather than fail vectorisation entirely. Tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ * tree-vectorizer.h (vect_grouped_load_supported): Add a single_element_p parameter. * tree-vect-data-refs.c (vect_grouped_load_supported): Likewise. Check the PR65518 case here rather than in vectorizable_load. * tree-vect-loop.c (vect_analyze_loop_2): Update call accordignly. * tree-vect-stmts.c (vectorizable_load): Likewise. From-SVN: r238037
2016-06-29re PR tree-optimization/70729 (Loop marked with omp simd pragma is not ↵Yuri Rumyantsev1-0/+3
vectorized) gcc/ 2016-06-29 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/70729 * tree-ssa-loop-im.c (ref_indep_loop_p_1): Consider memory reference as independent in loops having positive safelen value. * tree-vect-loop.c (vect_transform_loop): Clear-up safelen value since it may be not valid after vectorization. gcc/testsuite/ 2016-06-29 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/70729 * g++.dg/vect/pr70729.cc: New test. From-SVN: r237844
2016-06-17tree-vect-loop.c (vect_create_epilog_for_reduction): Only insert gimple seq ↵Bin Cheng1-1/+3
if it's not empty. * tree-vect-loop.c (vect_create_epilog_for_reduction): Only insert gimple seq if it's not empty. From-SVN: r237550
2016-06-15re PR tree-optimization/71483 (g++ ICE at -O3 on valid code on ↵Alan Hayward1-11/+7
x86_64-linux-gnu with “Floating point exception”) 2016-06-15 Alan Hayward <alan.hayward@arm.com> gcc/ PR tree-optimization/71483 * tree-vect-loop.c (vectorizable_live_operation): Pick correct index for slp testsuite/ PR tree-optimization/71483 * g++.dg/vect/pr71483.c: New From-SVN: r237483
2016-06-15re PR tree-optimization/71439 (wrong code at -O3 in 32-bit and 64-bit mode ↵Alan Hayward1-1/+5
on x86_64-linux-gnu) 2016-06-15 Alan Hayward <alan.hayward@arm.com> gcc/ PR tree-optimization/71439 * tree-vect-loop.c (vect_analyze_loop_operations): Additional check for live PHIs. testsuite/ PR tree-optimization/71439 * gcc.dg/vect/pr71439.c: New From-SVN: r237476
2016-06-13re PR tree-optimization/71416 (ICE at -O3 in 32-bit and 64-bit modes on ↵Alan Hayward1-4/+7
x86_64-linux-gnu (vectorizable_live_operation)) 2016-06-13 Alan Hayward <alan.hayward@arm.com> gcc/ PR tree-optimization/71416 * tree-vect-loop.c (vectorizable_live_operation): Let worklist have multiple entries From-SVN: r237375
2016-06-10re PR tree-optimization/71407 (ICE at -O3 in 32-bit and 64-bit modes on ↵Alan Hayward1-6/+9
x86_64-linux-gnu (verify_gimple: integral result type precision does not match field size of BIT_FIELD_REF)) 2016-06-10 Alan Hayward <alan.hayward@arm.com> gcc/ PR tree-optimization/71407 PR tree-optimization/71416 * tree-vect-loop.c (vectorizable_live_operation): Use vectype for BIT_FIELD_REF type. testsuite/ PR tree-optimization/71407 PR tree-optimization/71416 * gcc.dg/vect/pr71407.c: New * gcc.dg/vect/pr71416-1.c: New * gcc.dg/vect/pr71416-2.c: New From-SVN: r237288
2016-06-08tree-vect-data-refs.c (vect_analyze_data_refs): Remove debug newline.Alan Hayward1-27/+1
2016-06-08 Alan Hayward <alan.hayward@arm.com> gcc/ * tree-vect-data-refs.c (vect_analyze_data_refs): Remove debug newline. * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): likewise. (vect_can_advance_ivs_p): likewise. (vect_update_ivs_after_vectorizer): likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): likewise. (vect_analyze_scalar_cycles_1): likewise. (vect_analyze_loop_operations): likewise. (report_vect_op): likewise. (vect_is_slp_reduction): likewise. (vect_is_simple_reduction): likewise. (get_initial_def_for_induction): likewise. (vect_transform_loop): likewise. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): likewise. (vect_recog_sad_pattern): likewise. (vect_recog_widen_sum_pattern): likewise. (vect_recog_widening_pattern): likewise. (vect_recog_divmod_pattern): likewise. * tree-vect-slp.c (vect-build-slp_tree_1): likewise. (vect_analyze_slp_instance): likewise. (vect_transform_slp_perm_load): likewise. (vect_schedule_slp_instance): likewise. From-SVN: r237198
2016-06-03[3/3] No need to vectorize simple only-live stmtsAlan Hayward1-4/+5
2016-06-03 Alan Hayward <alan.hayward@arm.com> [3/3] No need to vectorize simple only-live stmts gcc/ * tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non live relevant stmts which are simple and invariant. * tree-vect-loop.c (vectorizable_live_operation): Check relevance instead of simple and invariant testsuite/ * gcc.dg/vect/vect-live-slp-5.c: Remove dg check. From-SVN: r237065
2016-06-03[2/3] Vectorize inductions that are live after the loopAlan Hayward1-66/+91
2016-06-03 Alan Hayward <alan.hayward@arm.com> [2/3] Vectorize inductions that are live after the loop gcc/ * tree-vect-loop.c (vect_analyze_loop_operations): Allow live stmts. (vectorizable_reduction): Check for new relevant state. (vectorizable_live_operation): vectorize live stmts using BIT_FIELD_REF. Remove special case for gimple assigns stmts. * tree-vect-stmts.c (is_simple_and_all_uses_invariant): New function. (vect_stmt_relevant_p): Check for stmts which are only used live. (process_use): Use of a stmt does not inherit it's live value. (vect_mark_stmts_to_be_vectorized): Simplify relevance inheritance. (vect_analyze_stmt): Check for new relevant state. * tree-vectorizer.h (vect_relevant): New entry for a stmt which is used outside the loop, but not inside it. testsuite/ * gcc.dg/tree-ssa/pr64183.c: Ensure test does not vectorize. * testsuite/gcc.dg/vect/no-scevccp-vect-iv-2.c: Remove xfail. * gcc.dg/vect/vect-live-1.c: New test. * gcc.dg/vect/vect-live-2.c: New test. * gcc.dg/vect/vect-live-3.c: New test. * gcc.dg/vect/vect-live-4.c: New test. * gcc.dg/vect/vect-live-5.c: New test. * gcc.dg/vect/vect-live-slp-1.c: New test. * gcc.dg/vect/vect-live-slp-2.c: New test. * gcc.dg/vect/vect-live-slp-3.c: New test. From-SVN: r237064
2016-06-01tree-vect-loop.c (vect_determine_vectorization_factor): Also compute the ↵Eric Botcazou1-1/+2
factor for live Phi nodes. * tree-vect-loop.c (vect_determine_vectorization_factor): Also compute the factor for live Phi nodes. From-SVN: r236999
2016-06-01tree-vect-loop.c (vect_determine_vectorization_factor): Also take into ↵Eric Botcazou1-1/+2
account live statements for mask producers. * tree-vect-loop.c (vect_determine_vectorization_factor): Also take into account live statements for mask producers. From-SVN: r236981
2016-05-30* tree-vect-loop.c (vect_transform_loop): Update likely bounds.Jan Hubicka1-3/+11
From-SVN: r236880
2016-05-30tree-vect-loop.c (vect_analyze_loop_2): Use likely_max_stmt_executions_int.Jan Hubicka1-1/+1
* tree-vect-loop.c (vect_analyze_loop_2): Use likely_max_stmt_executions_int. From-SVN: r236870
2016-05-24Clean up PURE_SLP_STMT handlingRichard Sandiford1-1/+1
The vectorizable_* routines had many instances of: slp_node || PURE_SLP_STMT (stmt_info) which gives the misleading impression that we can have !slp_node && PURE_SLP_STMT (stmt_info). In this context it's really enough to test slp_node on its own. There are three cases: loop vectorisation only: vectorizable_foo called only with !slp_node pure SLP: vectorizable_foo called only with slp_node hybrid SLP: (e.g. a vector that's used in SLP statements and also in a reduction) - vectorizable_foo called once with slp_node for the SLP uses. - vectorizable_foo called once with !slp_node for the non-SLP uses. Hybrid SLP isn't possible for stores, so I added an explicit assert for that. I also made vectorizable_comparison static, to make it obvious that no other callers outside tree-vect-stmts.c could use it with the !slp && PURE_SLP_STMT combination. Tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ * tree-vectorizer.h (vectorizable_comparison): Delete. * tree-vect-loop.c (vectorizable_reduction): Remove redundant PURE_SLP_STMT check. * tree-vect-stmts.c (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_load): Likewise. (vectorizable_condition): Likewise. (vectorizable_store): Likewise. Assert that we don't have hybrid SLP. (vectorizable_comparison): Make static. Remove redundant PURE_SLP_STMT check. (vect_transform_stmt): Assert that we always have an slp_node if PURE_SLP_STMT. From-SVN: r236642
2016-05-19tree-vect-loop.c (vect_analyze_loop_2): Use also max_loop_iterations_int.Jan Hubicka1-0/+2
* tree-vect-loop.c (vect_analyze_loop_2): Use also max_loop_iterations_int. From-SVN: r236478
2016-05-19re PR tree-optimization/69848 (poor vectorization of a loop from SPEC2006 ↵Bin Cheng1-12/+5
464.h264ref) PR tree-optimization/69848 * tree-vect-loop.c (vectorizable_reduction): Don't factor comparison expr out of VEC_COND_EXPR for COND_REDUCTION. From-SVN: r236447
2016-05-12re PR tree-optimization/71006 (ICE: verify_gimple failed (error: type ↵Ilya Enkovich1-1/+3
mismatch in conditional expression) w/ -O1 -ftree-loop-vectorize) gcc/ PR tree-optimization/71006 * tree-vect-loop.c (vect_determine_vectorization_factor): Don't consider COND_EXPR as a mask producer. gcc/testsuite/ PR tree-optimization/71006 * gcc.dg/pr71006.c: New test. From-SVN: r236171
2016-04-29tree-vect-loop.c (vect_transform_loop): Fix nb_iterations_upper_bound ↵Ilya Enkovich1-2/+4
computation for vectorized loop. gcc/ * tree-vect-loop.c (vect_transform_loop): Fix nb_iterations_upper_bound computation for vectorized loop. gcc/testsuite/ * gcc.target/i386/vect-unpack-2.c (avx512bw_test): Avoid optimization of vector loop. * gcc.target/i386/vect-unpack-3.c: New test. * gcc.dg/vect/vect-nb-iter-ub-1.c: New test. * gcc.dg/vect/vect-nb-iter-ub-2.c: New test. * gcc.dg/vect/vect-nb-iter-ub-3.c: New test. From-SVN: r235639
2016-04-12Revert r234572 (aka PR testsuite/70577)Martin Liska1-2/+0
Revert 2016-03-30 Jan Hubicka <hubicka@ucw.cz> * tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic estimates here. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also max_loop_iterations_int. (tree_unswitch_outer_loop): Likewise. * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. * tree-vect-loop.c (vect_analyze_loop_2): Likewise. From-SVN: r234902
2016-03-30tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic ↵Jan Hubicka1-0/+2
estimates here. * tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can't get realistic estimates here. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Use also max_loop_iterations_int. (tree_unswitch_outer_loop): Likewise. * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. * tree-vect-loop.c (vect_analyze_loop_2): Likewise. From-SVN: r234572
2016-03-16tree-vect-loop.c (vect_analyze_loop_2): Fix wrong dump info by reporting ↵Bin Cheng1-2/+3
malformed loop nest. * tree-vect-loop.c (vect_analyze_loop_2): Fix wrong dump info by reporting malformed loop nest. From-SVN: r234254
2016-03-03Skip properly debug stmt in optimize_mask_stores (PRMartin Liska1-1/+4
PR tree-optimization/70043 * tree-vect-loop.c (optimize_mask_stores): Move iterator to previous statement if we see a debug statement. * gfortran.dg/vect/pr70043.f90: New test. From-SVN: r233934
2016-02-29re PR tree-optimization/69720 (wrong code at -O3 on x86_64-linux-gnu)Richard Biener1-9/+22
2016-02-29 Richard Biener <rguenther@suse.de> PR tree-optimization/69720 * tree-vect-loop.c (get_initial_def_for_reduction): Avoid the adjustment_def path for possibly vectorized defs. (vect_create_epilog_for_reduction): Handle vectorized initial defs properly. * gcc.dg/vect/vect-outer-pr69720.c: New testcase. From-SVN: r233803
2016-02-22tree-vect-loop.c (vect_estimate_min_profitable_iters): Dump ↵Bin Cheng1-2/+2
min_profitable_estimate, rather than min_profitable_iters. * tree-vect-loop.c (vect_estimate_min_profitable_iters): Dump min_profitable_estimate, rather than min_profitable_iters. From-SVN: r233604
2016-02-10re PR tree-optimization/69652 ([ICE] verify_ssa fail w/ -O2 -ffast-math ↵Yuri Rumyantsev1-59/+75
-ftree-vectorize) gcc/ 2016-02-10 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/69652 * tree-vect-loop.c (optimize_mask_stores): Move declaration of STMT1 to nested loop, did source re-formatting, skip debug statements, add check on statement with volatile operand, remove dead scalar statements. gcc/testsuite/ 2016-02-10 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/69652 * gcc.dg/torture/pr69652.c: New test. From-SVN: r233275