Commit Graph

241 Commits

Author SHA1 Message Date
Richard Biener cc46a51d4f graphite.h: Do not include isl/isl_val_gmp.h, instead include isl/isl_val.h.
2017-02-16  Richard Biener  <rguenther@suse.de>

	* graphite.h: Do not include isl/isl_val_gmp.h, instead include
	isl/isl_val.h.
	* graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove.
	(gcc_expression_from_isl_expr_int): Use generic isl_val interface.
	* graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h.
	(isl_val_int_from_wi): New function.
	(extract_affine_gmp): Rename to ...
	(extract_affine_wi): ... this, take a widest_int.
	(extract_affine_int): Just wrap extract_affine_wi.
	(add_param_constraints): Use isl_val_int_from_wi.
	(add_loop_constraints): Likewise, and extract_affine_wi.

From-SVN: r245501
2017-02-16 07:53:53 +00:00
Richard Biener f877b3adba isl.m4: Remove support for ISL 0.14.
2017-02-13  Richard Biener  <rguenther@suse.de>

	config/
	* isl.m4: Remove support for ISL 0.14.

	* configure: Re-generate.

	gcc/
	* configure.ac (HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS):
	Remove.
	* configure: Re-generate.
	* config.in: Likewise.
	* graphite-dependences.c: Simplify as if
	HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS was defined.
	* graphite-isl-ast-to-gimple.c: Likewise.
	* graphite-optimize-isl.c: Likewise.
	* graphite-poly.c: Likewise.
	* graphite-sese-to-poly.c: Likewise.
	* graphite.h: Likewise.
	* toplev.c: Include isl/version.h and use isl_version () for
	printing the ISL version.
	* doc/install.texi: Update ISL requirement.

From-SVN: r245382
2017-02-13 08:54:02 +00:00
Richard Biener 8eedca0df1 re PR tree-optimization/77318 (FAIL: gfortran.dg/graphite/pr68279.f90 -O (internal compiler error))
2017-01-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77318
	* graphite-sese-to-poly.c (extract_affine): Fix assert.
	(create_pw_aff_from_tree): Take loop parameter.
	(add_condition_to_pbb): Pass loop of the condition to
	create_pw_aff_from_tree.

From-SVN: r245064
2017-01-31 14:44:37 +00:00
Martin Sebor efcc8d387f PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

	PR middle-end/77708
	* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
	* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
	New member functions.
	(format_directive): Used them.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.
	* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
	to avoid truncation for any argument.
	(extract_affine_mul): Same.
	* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

	PR middle-end/77708
	* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

	PR tree-optimization/78913
	PR middle-end/77708
	* trans-common.c (build_equiv_decl): Increase buffer size to avoid
	truncation for any argument.
	* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/77708
	* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
	due to bug 78969.
	* gcc.dg/format/pr78569.c: Adjust.

From-SVN: r244210
2017-01-08 16:42:09 -07:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Tom de Vries 09bf990eb8 Fix pdr accesses order
2016-04-09  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/68953
	* graphite-sese-to-poly.c (pdr_add_memory_accesses): Order accesses from
	first to last subscript.

	* gcc.dg/graphite/pr68953.c: New test.

From-SVN: r234851
2016-04-09 15:28:24 +00:00
Aditya Kumar adba512db0 new scop schedule for isl-0.15
Keep unchanged the implementation for isl-0.14.

	* graphite-poly.c (apply_poly_transforms): Simplify.
	(print_isl_set): Use more readable format: ISL_YAML_STYLE_BLOCK.
	(print_isl_map): Same.
	(print_isl_union_map): Same.
	(print_isl_schedule): New.
	(debug_isl_schedule): New.
	* graphite-dependences.c (scop_get_reads): Do not call
	isl_union_map_add_map that is undocumented isl functionality.
	(scop_get_must_writes): Same.
	(scop_get_may_writes): Same.
	(scop_get_original_schedule): Remove.
	(scop_get_dependences): Do not call isl_union_map_compute_flow that
	is deprecated in isl 0.15.  Instead, use isl_union_access_* interface.
	(compute_deps): Remove.
	* graphite-isl-ast-to-gimple.c (print_schedule_ast): New.
	(debug_schedule_ast): New.
	(translate_isl_ast_to_gimple::scop_to_isl_ast): Call set_separate_option.
	(graphite_regenerate_ast_isl): Add dump.
	(translate_isl_ast_to_gimple::scop_to_isl_ast): Generate code
	from scop->transformed_schedule.
	(graphite_regenerate_ast_isl): Add more dump.
	* graphite-optimize-isl.c (optimize_isl): Set
	scop->transformed_schedule.  Check whether schedules are equal.
	(apply_poly_transforms): Move here.
	* graphite-poly.c (apply_poly_transforms): ... from here.
	(free_poly_bb): Static.
	(free_scop): Static.
	(pbb_number_of_iterations_at_time): Remove.
	(print_isl_ast): New.
	(debug_isl_ast): New.
	(debug_scop_pbb): New.
	* graphite-scop-detection.c (print_edge): Move.
	(print_sese): Move.
	* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Remove.
	(build_scop_scattering): Remove.
	(create_pw_aff_from_tree): Assert instead of bailing out.
	(add_condition_to_pbb): Remove unused code, do not fail.
	(add_conditions_to_domain): Same.
	(add_conditions_to_constraints): Remove.
	(build_scop_context): New.
	(add_iter_domain_dimension): New.
	(build_iteration_domains): Initialize pbb->iterators.
	Call add_conditions_to_domain.
	(nested_in): New.
	(loop_at): New.
	(index_outermost_in_loop): New.
	(index_pbb_in_loop): New.
	(outermost_pbb_in): New.
	(add_in_sequence): New.
	(add_outer_projection): New.
	(outer_projection_mupa): New.
	(add_loop_schedule): New.
	(build_schedule_pbb): New.
	(build_schedule_loop): New.
	(embed_in_surrounding_loops): New.
	(build_schedule_loop_nest): New.
	(build_original_schedule): New.
	(build_poly_scop): Call build_original_schedule.
	* graphite.h: Declare print_isl_schedule and debug_isl_schedule.
	(free_poly_dr): Remove.
	(struct poly_bb): Add iterators.  Remove schedule, transformed, saved.
	(free_poly_bb): Remove.
	(debug_loop_vec): Remove.
	(print_isl_ast): Declare.
	(debug_isl_ast): Declare.
	(scop_do_interchange): Remove.
	(scop_do_strip_mine): Remove.
	(scop_do_block): Remove.
	(flatten_all_loops): Remove.
	(optimize_isl): Remove.
	(pbb_number_of_iterations_at_time): Remove.
	(debug_scop_pbb): Declare.
	(print_schedule_ast): Declare.
	(debug_schedule_ast): Declare.
	(struct scop): Remove schedule.  Add original_schedule,
	transformed_schedule.
	(free_gimple_poly_bb): Remove.
	(print_generated_program): Remove.
	(debug_generated_program): Remove.
	(unify_scattering_dimensions): Remove.
	* sese.c (print_edge): ... here.
	(print_sese): ... here.
	(debug_edge): ... here.
	(debug_sese): ... here.
	* sese.h (print_edge): Declare.
	(print_sese): Declare.
	(dump_edge): Declare.
	(dump_sese): Declare.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r232812
2016-01-26 00:19:20 +00:00
Aditya Kumar d8d262cf80 rewrite computation of iteration domains
* graphite-sese-to-poly.c (set_scop_parameter_dim): Remove.
        (cleanup_loop_iter_dom): Remove.
        (build_loop_iteration_domains): Remove.
        (build_scop_context): Remove.
        (build_scop_iteration_domain): Remove.
        (add_loop_constraints): New.
        (build_iteration_domains): New.
        (build_poly_scop): Call build_iteration_domains.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r232656
2016-01-21 02:13:33 +00:00
Aditya Kumar 14b1747c94 add more coalescing to simplify constraints
* graphite-dependences.c (constrain_domain): Add call to isl_*_coalesce.
	(add_pdr_constraints): Same.
	(scop_get_reads): Same.
	(scop_get_must_writes): Same.
	(scop_get_may_writes): Same.
	(scop_get_original_schedule): Same.
	(extend_schedule): Same.
	(apply_schedule_on_deps): Same.
	(carries_deps): Same.
	(compute_deps): Same.
	(scop_get_dependences): Same.
	* graphite-isl-ast-to-gimple.c
	(translate_isl_ast_to_gimple::generate_isl_schedule): Same.
	* graphite-optimize-isl.c (get_schedule_for_band): Same.
	(get_schedule_for_band_list): Same.
	(get_schedule_map): Same.
	(apply_schedule_map_to_scop): Same.
	* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
	(build_loop_iteration_domains): Same.
	(add_condition_to_pbb): Same.
	(add_param_constraints): Same.
	(pdr_add_memory_accesses): Same.
	(pdr_add_data_dimensions): Same.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r232650
2016-01-21 02:12:26 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Aditya Kumar 1cb287721a Use const-ref instead of values for sese_l passed to functions.
gcc/ChangeLog:

2015-12-24  hiraditya  <hiraditya@msn.com>

        * graphite-sese-to-poly.c (build_loop_iteration_domains): Use ref instead of value.
        * sese.c (invariant_in_sese_p_rec): Use const ref instead of value.
        (scalar_evolution_in_region): Same
        * sese.h (bb_in_region): Same
        (bb_in_sese_p): Same.
        (stmt_in_sese_p): Same.
        (defined_in_sese_p): Same.
        (loop_in_sese_p): Same.

From-SVN: r231947
2015-12-24 16:41:57 +00:00
Sebastian Pop e357a5e03c replace ISL with isl
From-SVN: r231784
2015-12-17 18:50:05 +00:00
Aditya Kumar 0ddb9c8d78 Use refs instead of values.
Passes bootstrap and regtest.

gcc/ChangeLog:

2015-12-15  hiraditya  <hiraditya@msn.com>

        * graphite-sese-to-poly.c (build_poly_sr): Use refs.

From-SVN: r231707
2015-12-16 17:33:00 +00:00
Aditya Kumar 560d18d3ed update required isl version
we check for a the isl compute timeout function added in isl 0.13.
That means GCC could still be configured with isl 0.13, 0.14, and 0.15.

	* config/isl.m4 (ISL_CHECK_VERSION): Check for
	isl_ctx_get_max_operations.
	* configure: Regenerate.

	gcc/
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Remove checks for functions that exist in isl 0.13 or
	later.
	* graphite-isl-ast-to-gimple.c: Remove #ifdefs and code for isl 0.12.
        * graphite-optimize-isl.c: Same.
	* graphite-poly.c: Same.
	* graphite-sese-to-poly.c: Same.
	* graphite.h: Add comment for isl 0.14.
	* toplev.c (print_version): Print isl version.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231706
2015-12-16 17:27:57 +00:00
Aditya Kumar ce6a2c929e add array access function in the right order
we used to add the access functions in the wrong order, Fortran style, leading to unprofitable interchanges.

	* graphite-sese-to-poly.c (pdr_add_memory_accesses): Iterate in
	the same order as adding data reference access functions.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231465
2015-12-09 18:35:47 +00:00
Aditya Kumar 2e733703c0 fix invalid bounds on array refs
While enabling graphite in -O3 we found a Fortran testcase that fails
because the max of the type domain is -1.  We used to add that as a constraint
to the elements accessed by the array, leading to a unfeasible constraint:
0 <= i <= -1.  Having that constraint, drops the data reference as that says
that there are no elements accessed in the array.

	* graphite-dependences.c (scop_get_reads): Add extra dumps.
	(scop_get_must_writes): Same.
	(scop_get_may_writes): Same.
	(compute_deps): Same.
	* graphite-sese-to-poly.c (bounds_are_valid): New.
	(pdr_add_data_dimensions): Call bounds_are_valid.

	* gfortran.dg/graphite/run-id-3.f90: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231191
2015-12-02 17:11:52 +00:00
Aditya Kumar 49385686db always print parameter names as P_{SSA_NAME_VERSION}
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r231085
2015-11-30 20:29:15 +00:00
Aditya Kumar cf98f0f49b move all declarations to a same .h file
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r230825
2015-11-24 17:57:45 +00:00
Aditya Kumar 0171d98d77 fix PR68314: revert all patches touching the construction of the original schedule
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r230778
2015-11-23 23:28:42 +00:00
Aditya Kumar 36f40be012 fix PR68279: bail out when scev gets instantiated to not_known
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r230771
2015-11-23 19:28:13 +00:00
David Edelsohn 4d77601199 Correct graphite*.c ISL header file inclusion order.
* system.h: Don't poison calloc and strdup if USES_ISL is defined.
* graphite-dependences.c: Define USES_ISL.  Include ISL header files
after GCC header files and before graphite header files.
* graphite-dependences.c: Same.
* graphite-isl-ast-to-gimple.c: Same.
* graphite-optimize-isl.c: Same.
* graphite-poly.c: Same.
* graphite-scop-detection.c: Same.
* graphite-sese-to-poly.c: Same.
* graphite.c: Same.

From-SVN: r230759
2015-11-23 09:23:59 -05:00
Aditya Kumar 65b016eb13 Preserve the original program while using graphite.
Earlier, graphite used to translate portions of the original program after
scop-detection in order to represent the SCoP into polyhedral model.  This was
required because each basic block was represented as independent basic block in
the polyhedral model. So all the cross-basic-block dependencies were translated
out-of-ssa.

With this patch those dependencies are also exposed to the ISL, so there is no
need to modify the original structure of the program.

After this patch we should be able to enable graphite at some default
optimization level.

Highlights:
Remove cross bb scalar to array translation
For reductions, add support for more than just INT_CST
Early bailout on codegen.
Verify loop-closed ssa structure during copy of renames
The uses of exprs should come from bb which dominates the bb
Collect the init value of close phi in loop-guard
Do not follow vuses for close-phi, postpone loop-close phi until the
    corresponding loop-phi is processed
Bail out if no bb found to place cond/loop -phis
Move insertion of liveouts at the end of codegen
Insert loop-phis in the loop-header.

This patch passes regtest and bootstrap with BOOT_CFLAGS='-O2 -fgraphite-identity -floop-nest-optimize'

2015-11-11  Aditya Kumar  <aditya.k7@samsung.com>
      Sebastian Pop  <s.pop@samsung.com>

	* graphite-isl-ast-to-gimple.c (class translate_isl_ast_to_gimple):
	  New member codegen_error
	(translate_isl_ast_for_loop): Remove call to single_succ_edge and early return.
	(translate_isl_ast_node_user): Early return in case of error.
	(translate_isl_ast_to_gimple::translate_isl_ast): Same.
	(translate_isl_ast_to_gimple::translate_pending_phi_nodes): New.
	(add_parameters_to_ivs_params): Remove macro.
	(graphite_regenerate_ast_isl): Add if_region pointer to region.
	* graphite-poly.c (new_poly_dr): Remove macro.
	(print_pdr): Same.
	(new_gimple_poly_bb): Same.
	(free_gimple_poly_bb): Same.
	(print_scop_params): Same.
	* graphite-poly.h (struct poly_dr): Same.
	(struct poly_bb): Add new_bb.
	(gbb_from_bb): Remove dead code.
	(pbb_from_bb): Same.
	* graphite-scop-detection.c (parameter_index_in_region_1): Same.
	(parameter_index_in_region): Same.
	(find_scop_parameters): Same.
	(build_cross_bb_scalars_def): New.
	(build_cross_bb_scalars_use): New.
	(graphite_find_cross_bb_scalar_vars): New
	(try_generate_gimple_bb): Reads and Writes.
	(build_alias_set): Move.
	(gather_bbs::before_dom_children): Gather bbs visited.
	(build_scops): call build_alias_set.
	* graphite-sese-to-poly.c (phi_arg_in_outermost_loop): Delete.
	(remove_simple_copy_phi): Delete.
	(remove_invariant_phi): Delete.
	(simple_copy_phi_p): Delete.
	(reduction_phi_p): Delete.
	(isl_id_for_dr): Remove unused param.
	(parameter_index_in_region_1): Remove macro usage.
	(set_scop_parameter_dim): Same.
	(add_param_constraints): Same.
	(add_conditions_to_constraints): Same
	(build_scop_iteration_domain): Same.
	(pdr_add_alias_set): Comment.
	(add_scalar_version_numbers): New.
	(build_poly_dr): ISL id.
	(build_scop_drs): Move.
	(build_poly_sr_1): Same.
	(insert_stmts): Remove.
	(build_poly_sr): New.
	(new_pbb_from_pbb): Delete.
	(insert_out_of_ssa_copy_on_edge): Delete.
	(create_zero_dim_array): Delete.
	(scalar_close_phi_node_p): Delete.
	(propagate_expr_outside_region): Delete.
	(rewrite_close_phi_out_of_ssa): Delete.
	(rewrite_phi_out_of_ssa): Delete.
	(rewrite_degenerate_phi): Delete.
	(rewrite_reductions_out_of_ssa): Delete.
	(rewrite_cross_bb_scalar_dependence): Delete.
	(handle_scalar_deps_crossing_scop_limits):
	(rewrite_cross_bb_scalar_deps): Delete.
	(build_poly_scop): Remove calls to out-of-ssa functions.
	* graphite.c (graphite_transform_loops): Early return in case of codegen error.
	* sese.c (debug_rename_map_1): Delete.
	(debug_rename_map): Delete.
	(sese_record_loop): Remove macro.
	(build_sese_loop_nests): Same.
	(new_sese_info): Same.
	(free_sese_info): Same.
	(sese_insert_phis_for_liveouts):
	(is_loop_closed_ssa_use): New.
	(number_of_phi_nodes): New.
	(bb_contains_loop_close_phi_nodes): New.
	(bb_contains_loop_phi_nodes): New.
	(phi_uses_name): New.
	(is_valid_rename):
	(get_rename): Add old_bb and loop_phi for more precise matching of
	exprs.
	(set_rename): Pass region.
	(later_of_the_two): New.
	(gsi_insert_earliest): New.
	(collect_all_ssa_names): New.
	(substitute_ssa_name): New.
	(rename_all_uses): New.
	(get_rename_from_scev): New.
	(rename_uses): Pass old_bb for more precise matching of exprs.
	(get_def_bb_for_const): New.
	(get_new_name): New.
	(get_loc): New.
	(get_edges): New.
	(copy_loop_phi_args): New.
	(copy_loop_phi_nodes): New.
	(get_loop_init_value): New.
	(find_init_value): New.
	(find_init_value_close_phi): New.
	(copy_loop_close_phi_args): New.
	(copy_loop_close_phi_nodes): New.
	(add_phi_arg_for_new_expr): New.
	(copy_cond_phi_args): New.
	(copy_cond_phi_nodes): New.
	(copy_phi_nodes): New.
	(should_copy_to_new_region): New.
	(set_rename_for_each_def): New.
	(graphite_copy_stmts_from_block): Early return in case of error.
	(copy_bb_and_scalar_dependences): Same.
	* sese.h (vec_find): New.
	(SESE_PARAMS): Delete.
	(SESE_LOOPS): Delete.
	(SESE_LOOP_NEST): Delete.
	(sese_contains_loop): Remove macro usage.
	(sese_nb_params): Same.
	(struct gimple_poly_bb): Added read_scalar_refs, write_scalar_refs.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r230200
2015-11-12 00:37:47 +00:00
Abderrazek Zaafrani eefa4bafa5 improve construction of the original schedule
The patch builds the original schedule based on the now optimized scattering
dimension instead of building one based on the loop index only.

The implementation is simpler and catches more cases where the original schedule
and the transformed schedule are the same, such as the one below:

for (i = 0; i < 1000; i++)
{
  Temp = F[i];
  for (j = 0; j < 1000; j++)
 {
    D[j] = E[j]  * Temp;
    A[i][j] = A[i][j]  + B[i][j] * C[i][j] - D[j] ;
  }
  D[i] = E[i] * F[i];
}

  * graphite-sese-to-poly.c (build_scop_original_schedule): Call
  isl_union_map_add_map on every pbb->schedule.

From-SVN: r230191
2015-11-11 20:43:51 +00:00
Abderrazek Zaafrani 0473915e63 add original schedule to scop
* graphite-optimize-isl.c (optimize_isl): Call isl_union_map_is_equal.
    * graphite-poly.c (new_scop): Initialize original_schedule.
    (free_scop): Free original_schedule.
    * graphite-poly.h (struct scop): Add field original_schedule.
    * graphite-sese-to-poly.c (build_scop_original_schedule): New.
    (build_poly_scop): Call build_scop_original_schedule.

From-SVN: r229910
2015-11-07 01:32:27 +00:00
Abderrazek Zaafrani 504fbc11f4 do not create unnecessary dimensions in scop scattering
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Remove.
           (build_pbb_minimal_scattering_polyhedrons): New.
           (build_scop_scattering): Remove.
           (build_scop_minimal_scattering): New.
           (build_scop_scattering): Call build_pbb_minimal_scattering_polyhedrons.
           (build_poly_scop): Call build_scop_minimal_scattering.

From-SVN: r229909
2015-11-07 01:32:20 +00:00
Aditya Kumar 1b38d3ecfe improve debug of codegen
- fix printing of ISL stmt and parameter names
- move dot_scop* functions outside of anonymous namespace.

  * graphite-isl-ast-to-gimple.c: Include tree-cfg.h.
  (translate_isl_ast_node_user): Add more dumps: call print_loops_bb.
  * graphite-scop-detection.c (dot_all_scops_1): Moved out of
  anonymous namespace.
  * graphite-sese-to-poly.c (ssa_name_version_typesize): Remove.
  (isl_id_for_pbb): Use a buffer of size 10.
  (isl_id_for_ssa_name): Same.
  * sese.c (set_rename): Add more dumps.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r229782
2015-11-04 20:59:12 +00:00
Mikhail Maltsev b2b293775a [PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
[PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
gcc/lto/ChangeLog:
2015-10-27  Mikhail Maltsev  <maltsevm@gmail.com>

	* lto.c (unify_scc): Use flag_checking and remove ENABLE_CHECKING
	conditionals.
	(lto_fixup_state): Likewise.
	(do_whole_program_analysis): Use
	symtab_node::checking_verify_symtab_nodes and remove ENABLE_CHECKING
	conditionals.

gcc/ChangeLog:

2015-10-27  Mikhail Maltsev  <maltsevm@gmail.com>

	* attribs.c (check_attribute_tables): New function, broken out from...
	(init_attributes): Use it.
	* cfgcleanup.c (try_optimize_cfg): Use flag_checking, CHECKING_P
	gcc_checking_assert and checking_* functions to eliminate
	ENABLE_CHECKING conditionals.
	* cfgexpand.c (expand_goto, expand_debug_expr): Likewise.
	(pass_expand::execute): Likewise.
	* cgraphclones.c (symbol_table::materialize_all_clones): Likewise.
	* cgraphunit.c (mark_functions_to_output): Likewise.
	(cgraph_node::expand_thunk): Likewise.
	(symbol_table::compile): Likewise.
	* ddg.c (add_cross_iteration_register_deps): Likewise.
	(create_ddg_all_sccs): Likewise.
	* df-core.c (df_finish_pass, df_analyze): Likewise.
	* diagnostic-core.h: Likewise.
	* diagnostic.c (diagnostic_report_diagnostic): Likewise.
	* dominance.c (calculate_dominance_info): Likewise.
	* dwarf2out.c (add_AT_die_ref): Likewise.
	(const_ok_for_output_1, mem_loc_descriptor): Likewise.
	(loc_list_from_tree, gen_lexical_block_die): Likewise.
	gen_type_die_with_usage, gen_type_die): Likewise.
	(dwarf2out_decl): Likewise.
	* emit-rtl.c (verify_rtx_sharing, reorder_insns_nobb): Likewise.
	* except.c (duplicate_eh_regions): Likewise.
	* fwprop.c (register_active_defs, update_df_init): Likewise.
	(fwprop_init, fwprop_done): Likewise.
	(update_uses): Likewise.
	* ggc-page.c (ggc_grow): Likewise.
	* gimplify.c (gimplify_body): Likewise.
	(gimplify_hasher::equal): Likewise.
	* graphite-isl-ast-to-gimple.c (graphite_verify): Likewise.
	* graphite-scop-detection.c (canonicalize_loop_closed_ssa_form):
	Likewise.
	* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Likewise.
	(rewrite_cross_bb_scalar_deps_out_of_ssa): Likwise.
	* hash-table.h (::find_empty_slot_for_expand): Likewise.
	* ifcvt.c (if_convert): Likewise.
	* ipa-cp.c (ipcp_propagate_stage): Likewise.
	* ipa-devirt.c (type_in_anonymous_namespace_p): Likewise.
	(odr_type_p, odr_types_equivalent_p): Likewise.
	(add_type_duplicate, get_odr_type): Likewise.
	* ipa-icf.c (sem_item_optimizer::execute): Likewise.
	(sem_item_optimizer::subdivide_classes_by_equality): Likewise.
	(sem_item_optimizer::verify_classes): Likewise.
	(sem_item_optimizer::traverse_congruence_split): Likewise.
	(sem_item_optimizer::checking_verify_classes): New.
	* ipa-icf.h (sem_item_optimizer::checking_verify_classes): Add new
	method.
	* cfgrtl.c (commit_edge_insertions): Likewise.
	(fixup_reorder_chain, cfg_layout_finalize): Likewise.
	(rtl_flow_call_edges_add): Likewise.
	* cgraph.c (symbol_table::create_edge): Likewise.
	(cgraph_edge::redirect_call_stmt_to_callee): Likewise.
	* cgraph.h (symtab_node): Likewise.
	(symtab_node::checking_verify_symtab_nodes): Define.
	(cgraph_node::checking_verify_cgraph_nodes): Define.
	* cfghooks.h (checking_verify_flow_info): Define.
	* cfgloop.h (checking_verify_loop_structure): Define.
	* dominance.h (checking_verify_dominators): Define.
	* et-forest.c: Fix comment.
	* ipa-inline-analysis.c (compute_inline_parameters): Use flag_checking,
	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
	ENABLE_CHECKING conditionals.
	* ipa-inline-transform.c (save_inline_function_body): Likewise.
	* ipa-inline.c (inline_small_functions): Likewise.
	(early_inliner): Likewise.
	* ipa-inline.h (estimate_edge_growth): Likewise.
	* ipa-visibility.c (function_and_variable_visibility): Likewise.
	* ipa.c (symbol_table::remove_unreachable_nodes): Likewise.
	(ipa_single_use): Likewise.
	* ira-int.h: Likewise.
	* ira.c (ira): Likewise.
	* loop-doloop.c (doloop_optimize_loops): Likewise.
	* loop-init.c (loop_optimizer_init, fix_loop_structure): Likewise.
	* loop-invariant.c (move_loop_invariants): Likewise.
	* lra-assigns.c (lra_assign): Likewise.
	* lra-constraints.c (lra_constraints): Likewise.
	* lra-eliminations.c (lra_eliminate): Likewise.
	* lra-int.h (struct lra_reg): Likewise.
	* lra-lives.c (check_pseudos_live_through_calls): Likewise.
	(lra_create_live_ranges_1): Likewise.
	* lra-remat.c (create_remat_bb_data): Likewise.
	* lra.c (lra_update_insn_recog_data, restore_scratches): Likewise.
	(lra): Likewise.
	(check_rtl): Always define. Remove incorrect guard around
	extract_constrain_insn call.
	* lto-cgraph.c (input_cgraph_1: Use flag_checking,
	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
	ENABLE_CHECKING conditionals.
	* lto-streamer-out.c (DFS::DFS): Likewise.
	(lto_output): Likewise.
	* lto-streamer.c (lto_streamer_init): Likewise.
	* omp-low.c (scan_omp_target, expand_omp_taskreg): Likewise.
	expand_omp_target, execute_expand_omp): Likewise.
	(lower_omp_target): Likewise.
	* passes.c (execute_function_todo): Likewise.
	(execute_todo, execute_one_pass): Likewise.
	(verify_curr_properties): Always define.
	* predict.c (tree_estimate_probability: Use flag_checking,
	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
	ENABLE_CHECKING conditionals.
	(propagate_freq): Likewise.
	* pretty-print.c (pp_format): Likewise.
	* real.c (real_to_decimal_for_mode): Likewise.
	* recog.c (split_all_insns): Likewise.
	* regcprop.c (kill_value_one_regno): Likewise.
	(copy_value): Likewise.
	(validate_value_data): Define unconditionally.
	* reload.c: Fix comment.
	* timevar.c: Include options.h
	* tree-ssa.h (checking_verify_ssa): Define.
	* tree-ssa-loop-manip.h (checking_verify_loop_closed_ssa): Define.
	* sched-deps.c (CHECK): Remove unused macro.
	(add_or_update_dep_1, sd_add_dep: Use flag_checking, CHECKING_P
	gcc_checking_assert and checking_* functions to eliminate
	ENABLE_CHECKING conditionals.
	* sel-sched-ir.c (free_regset_pool, tidy_control_flow): Likewise.
	* sel-sched.c (struct moveop_static_params): Likewise.
	(find_best_reg_for_expr, move_cond_jump): Likewise.
	(move_op_orig_expr_not_found): Likewise.
	(code_motion_process_successors, move_op): Likewise.
	* ssa-iterators.h (first_readonly_imm_use): Likewise.
	(next_readonly_imm_use): Likewise.
	* store-motion.c (compute_store_table): Likewise.
	* symbol-summary.h (function_summary::function_summary): Likewise.
	* target.h (cumulative_args_t): Likewise.
	(get_cumulative_args, pack_cumulative_args): Likewise.
	* timevar.c: (timer::print): Likewise.
	* trans-mem.c (ipa_tm_execute): Likewise.
	* tree-cfg.c (move_stmt_op): Likewise.
	(move_sese_region_to_fn): Likewise.
	(gimple_flow_call_edges_add): Likewise.
	* tree-cfgcleanup.c (cleanup_tree_cfg_noloop, repair_loop_structures):
	Likewise.
	* tree-eh.c (remove_unreachable_handlers): Likewise.
	* tree-if-conv.c (pass_if_conversion::execute): Likewise.
	* tree-inline.c (expand_call_inline, optimize_inline_calls): Likewise.
	* tree-into-ssa.c (update_ssa): Likewise.
	* tree-loop-distribution.c (pass_loop_distribution::execute): Likewise.
	* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees): Likewise.
	* tree-parloops.c (pass_parallelize_loops::execute): Likewise.
	* tree-predcom.c (suitable_component_p): Likewise.
	* tree-profile.c (gimple_gen_const_delta_profiler): Likewise.
	* tree-ssa-alias.c (refs_may_alias_p_1): Likewise.
	* tree-ssa-live.c (verify_live_on_entry): Likewise.
	* tree-ssa-live.h (register_ssa_partition): Likewise.
	* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Likewise.
	* tree-ssa-loop-manip.c (add_exit_phi): Likewise.
	(tree_transform_and_unroll_loop): Likewise.
	* tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
	* tree-ssa-operands.c (get_expr_operands): Likewise.
	* tree-ssa-propagate.c (replace_exp_1): Likewise.
	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
	* tree-ssa-ter.c (free_temp_expr_table): Likewise.
	* tree-ssa-threadupdate.c (duplicate_thread_path): Likewise.
	* tree-ssanames.c (release_ssa_name_fn): Likewise.
	* tree-stdarg.c (expand_ifn_va_arg): Likewise.
	* tree-vect-loop-manip.c
	(slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
	(slpeel_checking_verify_cfg_after_peeling): Likewise.
	(vect_do_peeling_for_loop_bound): Likewise.
	(vect_do_peeling_for_alignment): Likewise.
	* tree-vrp.c (supports_overflow_infinity): Likewise.
	(set_value_range): Likewise.
	* tree.c (free_lang_data_in_cgraph): Likewise.
	* value-prof.c (gimple_remove_histogram_value): Likewise.
	(free_hist): Likewise.
	* var-tracking.c (canonicalize_values_star): Likewise.
	(compute_bb_dataflow, vt_find_locations, vt_emit_notes): Likewise.

From-SVN: r229470
2015-10-27 19:05:53 -06:00
Aditya Kumar 78fd2726ca a scalar depending on vdefs in the current region is not invariant
When a scalar is defined in function of an array reference in the current scop,
it does variate.  Graphite cannot represent the condition in scop-11.c, as a[*]
variates in the current region, and it is not an affine condition:

  for (j = 0; j <= 20; j++)
    a[j] = b + i;

  if (a[12] == 23)
    b = 3;
  else
    b = 1;

  for (j = 0; j <= 20; j++)
    a[j] = b + i;

	* graphite-scop-detection.c (parameter_index_in_region): Update call to
	invariant_in_sese_p_rec.
	* graphite-sese-to-poly.c (extract_affine): Same.
	* sese.c (invariant_in_sese_p_rec): Pass in an extra parameter has_vdefs.
	(scalar_evolution_in_region): Return chrec_dont_know when the scalar variable
	depends on virtual definitions in the current region.
	* sese.h (invariant_in_sese_p_rec): Update declaration.

testsuite/
	* gcc.dg/graphite/scop-11.c: Update pattern.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r229151
2015-10-21 21:18:27 +00:00
Aditya Kumar caf5b4dfca Refactor graphite-sese-to-poly, sese.h, graphite-poly.h
Now that scop contains a list of all the basic blocks inside, it makes sense to
iterate over only those basic blocks in
graphite-sese-to-poly.c:rewrite_reductions_out_of_ssa,rewrite_cross_bb_scalar_deps_out_of_ssa

Passes regtest and bootstrap.

gcc/ChangeLog:

2015-10-20  Aditya Kumar  <hiraditya@msn.com>

        * graphite-poly.h (struct dr_info): Added invalid_alias_set number.
        (operator=): Removed.
        (dr_info): Make alias_set number the last argument with default value of invalid_alias_set.
        * graphite-sese-to-poly.c (build_scop_drs): Update constructor of dr_info.
        (rewrite_reductions_out_of_ssa): Iterate only through the basic blocks which are inside region.
        (rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
        * sese.h (struct sese_l): Removed assignment operator.
        (split_region_for_bb): Removed dead code.

From-SVN: r229136
2015-10-21 18:53:26 +00:00
Aditya Kumar d37fc3aa4a Refactoring sese.h and graphite-poly.h
Rename scop->region to scop->scop_info
Removed conversion constructors for sese_l and dr_info.
Removed macros.

No functional changed intended. Passes regtest and bootstrap.

gcc/ChangeLog:

2015-19-10  Aditya Kumar  <aditya.k7@samsung.com>
        * graphite-poly.h (struct dr_info): Removed conversion constructor.
        (struct scop): Renamed scop::region to scop::scop_info
        (scop_set_region): Same.
        (SCOP_REGION): Removed
        (SCOP_CONTEXT): Removed.
        (POLY_SCOP_P): Removed.
        * graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user):
        Rename scop->region to scop->scop_info.
        (add_parameters_to_ivs_params): Same.
        (graphite_regenerate_ast_isl): Same.
        * graphite-poly.c (new_scop): Same.
        (free_scop): Same.
        (print_scop_params): Same.
        * graphite-scop-detection.c (scop_detection::remove_subscops): Same.
        (scop_detection::remove_intersecting_scops): Use pointer to sese_l.
        (dot_all_scops_1): Rename scop->region to scop->scop_info.
        (scop_detection::nb_pbbs_in_loops): Same.
        (find_scop_parameters): Same.
        (try_generate_gimple_bb): Same.
        (gather_bbs::before_dom_children): Same.
        (gather_bbs::after_dom_children): Same.
        (build_scops): Same.
        * graphite-sese-to-poly.c (build_scop_scattering): Same.
        (extract_affine_chrec): Same.
        (extract_affine): Same.
        (set_scop_parameter_dim): Same.
        (build_loop_iteration_domains): Same.
        (create_pw_aff_from_tree): Same.
        (add_param_constraints): Same.
        (build_scop_iteration_domain): Same.
        (build_scop_drs): Same.
        (analyze_drs_in_stmts): Same.
        (insert_out_of_ssa_copy_on_edge): Same.
        (rewrite_close_phi_out_of_ssa):Same.
        (rewrite_reductions_out_of_ssa):Same.
        (handle_scalar_deps_crossing_scop_limits):Same.
        (rewrite_cross_bb_scalar_deps):Same.
        (rewrite_cross_bb_scalar_deps_out_of_ssa):Same.
        (build_poly_scop):Same.
        (build_alias_set): Use pointer to dr_info.
        * graphite.c (print_graphite_scop_statistics):
        (graphite_transform_loops):
        * sese.h (struct sese_l): Remove conversion constructor.

From-SVN: r229135
2015-10-21 18:53:17 +00:00
Aditya Kumar b0b5710cf6 gather bbs and conditions in a single walk through dominators
Clean up the function to build scop's basic blocks and the function
that gathers the conditions under which a basic block is executed.  We remove
one traversal of the dominator tree.

This refactoring was triggered by the need of a vec<bb> of all the basic blocks
in a region.  We will use that vector in a patch that removes the out-of-ssa
translation of scalar dependences: we will iterate through the basic blocks of a
region to record scalar dependences crossing bbs or going out of the region.

The patch passes bootstrap and regtest on x86_64-linux.

2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-dependences.c (scop_get_dependences): Do not use SCOP_BBS.
                * graphite-isl-ast-to-gimple.c (get_max_schedule_dimensions): Same.
                (generate_isl_schedule): Same.
                * graphite-optimize-isl.c (scop_get_domains): Same.
                (apply_schedule_map_to_scop): Same.
                * graphite-poly.c (print_iteration_domains): Same.
                (remove_gbbs_in_scop): Same.
                (new_scop): Same.
                (free_scop): Same.
                (print_scop): Same.
                * graphite-poly.h (struct scop): Rename bbs to pbbs.
                (SCOP_BBS): Remove.
                * graphite-scop-detection.c (compare_bb_depths): Remove.
                (graphite_sort_dominated_info): Remove.
                (try_generate_gimple_bb): Move out of scop_detection.
                (all_non_dominated_preds_marked_p): Remove.
                (build_scop_bbs_1): Remove.
                (build_scop_bbs): Remove.
                (nb_pbbs_in_loops): Do not use SCOP_BBS.
                (find_scop_parameters): Same.
                (sese_dom_walker): Rename gather_bbs.
                (before_dom_children): Call try_generate_gimple_bb and collect gbb
                and pbb.
                (build_scops): Call gather_bbs.
                * graphite-sese-to-poly.c (build_scop_scattering): Do not use SCOP_BBS.
                (add_conditions_to_constraints): Same.
                (build_scop_iteration_domain): Same.
                (build_scop_drs): Same.
                (new_pbb_from_pbb): Same.
                * sese.c (new_sese_info): Create bbs.
                * sese.h (struct sese_info_t): Add bbs.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228581
2015-10-07 19:25:35 +00:00
Aditya Kumar bafcb15301 move graphite bookkeeping from sese to sese_info
2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-isl-ast-to-gimple.c (translate_isl_ast_to_gimple): Use
                an sese_info_p.
                (copy_def): Same.
                (copy_internal_parameters): Same.
                (translate_isl_ast_to_gimple): Use an sese_l.
                (build_iv_mapping): Same.
                * graphite-poly.c (new_sese): Rename new_sese_info.
                (free_sese): Rename free_sese_info.
                * graphite-poly.h (struct scop): Use an sese_info_p.
                (scop_set_region): Same.
                * graphite-scop-detection.c (struct sese_l): Moved...
                (get_entry_bb): Moved...
                (get_exit_bb): Moved...
                (parameter_index_in_region_1): Use an sese_info_p.
                (parameter_index_in_region): Same.
                (scan_tree_for_params): Same.
                (find_params_in_bb): Same.
                (sese_dom_walker): Use an sese_l.
                * graphite-sese-to-poly.c (remove_invariant_phi): Same.
                (reduction_phi_p): Same.
                (parameter_index_in_region_1): Use an sese_info_p.
                (propagate_expr_outside_region): Use an sese_l.
                * graphite.c: Replace uses of SCOP_REGION.
                * sese.c (sese_record_loop): Use an sese_info_p.
                (build_sese_loop_nests): Same.
                (sese_build_liveouts_use): Same.
                (sese_build_liveouts_bb): Same.
                (sese_build_liveouts_bb): Same.
                (sese_bad_liveouts_use): Same.
                (sese_reset_debug_liveouts_bb): Same.
                (sese_build_liveouts): Same.
                (new_sese): Renamed new_sese_info.
                (free_sese): Renamed free_sese_info.
                (set_rename): Use an sese_info_p.
                (graphite_copy_stmts_from_block): Same.
                (copy_bb_and_scalar_dependences): Same.
                (outermost_loop_in_sese_1): Use an sese_l.
                (outermost_loop_in_sese): Same.
                (if_region_set_false_region): Use an sese_info_p.
                (move_sese_in_condition): Same.
                (scalar_evolution_in_region): Use an sese_l.
                * sese.h (struct sese_l): ... here.
                (SESE_ENTRY): Remove.
                (SESE_ENTRY_BB): Remove.
                (SESE_EXIT): Remove.
                (SESE_EXIT_BB): Remove.
                (sese_contains_loop): Use an sese_info_p.
                (sese_nb_params): Same.
                (bb_in_sese_p): Use an sese_l.
                (stmt_in_sese_p): Same.
                (defined_in_sese_p): Same.
                (loop_in_sese_p): Same.
                (sese_loop_depth): Same.
                (struct ifsese_s): Use an sese_info_p.
                (gbb_loop_at_index): Use an sese_l.
                (nb_common_loops): Same.
                (scev_analyzable_p): Same.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228572
2015-10-07 15:40:17 +00:00
Aditya Kumar 09fefdad6a move dr->alias_set to a helper structure
2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-poly.c (new_scop): Initialize drs.
                * graphite-poly.h (struct dr_info): New.
                (struct scop): Add drs.
                * graphite-sese-to-poly.c (pdr_add_alias_set): Use dr_info.
                (pdr_add_memory_accesses): Same.
                (build_poly_dr): Same.
                (build_alias_set): Same.
                (build_scop_drs): Same.
                (build_pbb_drs): Remove.
                * tree-data-ref.c (create_data_ref): Do not initialize alias_set.
                * tree-data-ref.h (data_reference): Remove alias_set.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228545
2015-10-06 20:50:35 +00:00
Aditya Kumar 790befae61 remove unused struct base_alias_pair
2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-poly.c (free_data_refs_aux): Remove.
                (free_gimple_poly_bb): Do not call free_data_refs_aux.
                * graphite-poly.h (struct base_alias_pair): Remove.
                * graphite-sese-to-poly.c (pdr_add_alias_set): Remove all uses of
                base_alias_pair and dr->aux.
                (build_alias_set): Same.
                * tree-data-ref.c (create_data_ref): Initialize alias_set.
                * tree-data-ref.h (data_reference): Add alias_set.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228544
2015-10-06 20:50:29 +00:00
Aditya Kumar 4fd0b1760d remove dead code in computation of alias sets
2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-poly.c (new_poly_dr): Remove dr_base_object_set.
                Do not set PDR_BASE_OBJECT_SET.
                * graphite-poly.h (poly_dr): Same.
                (PDR_BASE_OBJECT_SET): Remove.
                (new_poly_dr): Update decl.
                * graphite-sese-to-poly.c (build_poly_dr): Update call to
                new_poly_dr.
                (write_alias_graph_to_ascii_dimacs): Remove.
                (write_alias_graph_to_ascii_dot): Remove.
                (write_alias_graph_to_ascii_ecc): Remove.
                (dr_same_base_object_p): Remove.
                (build_alias_set_optimal_p): Rename build_alias_set.  Remove dead
                code.
                (build_base_obj_set_for_drs): Remove.
                (dump_alias_graphs): Remove.
                (build_scop_drs): Remove dead code.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228543
2015-10-06 20:50:22 +00:00
Aditya Kumar 216cc294ef Early exit to avoid redundant computations
Analyze only those bbs which are outside the region for uses which might be
defined inside the region. This is intended to improve the compile time. This
algorithm may be further improved by only looking at the successors of region as
these regions are sese. Added FIXMEs to make this improvement in future.

Passes regtest and bootstrap on x86_64.

gcc/ChangeLog:

2015-10-05  Aditya Kumar  <hiraditya@msn.com>

        * graphite-sese-to-poly.c (build_loop_iteration_domains): Only loops
        which are in this region are passed so gcc_assert and remove redundant
        computation.
        * sese.c (sese_build_liveouts): Pass only those bbs which are not in region.
        (sese_bad_liveouts_use): Only BBs which are not in region are passed so
        gcc_assert on that and remove unnecessary computation.
        (sese_build_liveouts_use): Same.

From-SVN: r228529
2015-10-06 15:56:09 +00:00
Aditya Kumar 8e4dc590c8 Move declarations, assign types, renaming.
1. Move declarations near the assignment/usage.
2. Assign type to members which were void*.
3. Rename scop->context to scop::param_context, and scop::ctx to
scop::isl_context

No functional changes intended. Passes regtest and bootstrap.

gcc/ChangeLog:

2015-10-05  Aditya Kumar  <aditya.k7@samsung.com>

        * graphite-dependences.c (scop_get_reads): Renamed scop->context to scop->param_context.
        (scop_get_must_writes): Same.
        (scop_get_may_writes): Same.
        (scop_get_original_schedule): Same.
        (scop_get_transformed_schedule): Same.
        (subtract_commutative_associative_deps): Same.
        * graphite-isl-ast-to-gimple.c (add_parameters_to_ivs_params): Same.
        (generate_isl_context): Same.
        (generate_isl_schedule): Same.
        (scop_to_isl_ast): Same.
        (graphite_regenerate_ast_isl): Same.
        * graphite-optimize-isl.c (scop_get_domains): Same.
        (optimize_isl): Renamed scop->context to scop->param_context.
        * graphite-poly.c (new_poly_bb): Change the type of argument to gimple_poly_bb_p.
        (new_scop): Renamed scop->context to scop->param_context.
        (free_scop): Same.
        (print_scop_context): Same.
        * graphite-poly.h (new_poly_dr): Change the type of argument from void* to data_reference_p.
        (struct poly_bb): Change the type of black_box to gimple_poly_bb_p.
        (new_poly_bb): Change the type of argument from void* to gimple_poly_bb_p.
        (pbb_set_black_box): Same.
        (struct scop): Rename context to param_context, ctx to isl_context.
        * graphite-scop-detection.c (scop_detection::build_scop_bbs_1): Move declarations closer to assignment.
        (find_params_in_bb): Same.
        (find_scop_parameters): Same.
        * graphite-sese-to-poly.c (unsigned ssa_name_version_typesize): Global to be used for statement IDs.
        (isl_id_for_pbb): Use ssa_name_version_typesize.
        (simple_copy_phi_p): Move declarations closer to assignment.
        (build_pbb_scattering_polyhedrons): Same.
        (build_scop_scattering): Same.
        (isl_id_for_ssa_name): Same.
        (extract_affine_name): Same.
        (extract_affine_int): Same.
        (extract_affine): Same.
        (set_scop_parameter_dim): Use renamed member.
        (build_loop_iteration_domains): Same.
        (add_param_constraints): Same.
        (build_scop_iteration_domain): Same.
        (pdr_add_data_dimensions): Same.
        (build_poly_dr): Same.
        (build_scop_drs): Move declarations closer to assignment.
        (analyze_drs_in_stmts): Same.
        (insert_out_of_ssa_copy): Same.
        (insert_out_of_ssa_copy_on_edge): Same.
        (propagate_expr_outside_region): Same.
        (rewrite_phi_out_of_ssa): Same.
        (rewrite_degenerate_phi): Same.
        (rewrite_reductions_out_of_ssa): Same.
        (rewrite_cross_bb_scalar_dependence): Same.
        (handle_scalar_deps_crossing_scop_limits): Same.
        (rewrite_cross_bb_scalar_deps): Same.
        * graphite.c (graphite_transform_loops): Use renamed member.

From-SVN: r228528
2015-10-06 15:56:03 +00:00
Aditya Kumar 87ccab5d9c move param detection to scop detection
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228493
2015-10-05 16:03:09 +00:00
Aditya Kumar 076d564d30 move scop detection related stuff to graphite-scop-detection.c
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228492
2015-10-05 16:02:59 +00:00
Aditya Kumar 000051e1c5 reject loops early where ivs cannot be represented
From-SVN: r228403
2015-10-02 16:04:00 +00:00
Aditya Kumar 65ef70d695 Rename gimple_bb to gimple_poly_bb
Renaming gimple_bb to gimple_poly_bb because there is a function gimple_bb
by the same name in gimple.h. No functional change intended.
Passes regtest and bootstrap.

gcc/ChangeLog:

2015-10-01  Aditya Kumar  <hiraditya@msn.com>

        * graphite-isl-ast-to-gimple.c (class translate_isl_ast_to_gimple):
	Renamed type from gimple_bb_p to gimple_poly_bb_p.
        (translate_isl_ast_node_user): Same.
        * graphite-poly.c (new_poly_bb): Same.
        * graphite-poly.h (gbb_from_bb): Same.
        * sese.h: Same.
        * graphite-sese-to-poly.c (new_gimple_bb): gimple_bb_p -> gimple_poly_bb_p
        (build_scop_scattering): Same.
        (find_params_in_bb): Same.
        (add_conditions_to_domain): Same.
        (sese_dom_walker::before_dom_children): Same.
        (analyze_drs_in_stmts): Same.
        (new_pbb_from_pbb): Same.
        (free_data_refs_aux): New pointer to type base_alias_pair.
        * graphite-sese-to-poly.h: Same.
        * sese.c (if_region_set_false_region): Fixed Indentation.
        (move_sese_in_condition): Same.

From-SVN: r228358
2015-10-01 22:04:14 +00:00
Sebastian Pop 95ad241797 call scev analysis in scop-detection as in sese-to-poly
Before our rewrite of the scop detection, we used to not have a valid SESE
region under hand, and so we used to do more ad-hoc analysis of data references
by trying to prove that at all levels of a loop nest the data references would
be still valid.

Now that we have a valid SESE region, we can call the scev analysis in the same
way on the same computed loop nest in the scop-detection as in the sese-to-poly.

Next step will be to cache the data references analyzed in the scop detection
and not compute the same info in sese-to-poly.

The patch fixes block-1.f90 that used to ICE on x86_64-linux when compiled with
-m32.  Patch passed bootstrap with BOOT_CFLAGS="-g -O2 -fgraphite-identity
-floop-nest-optimize" and check on x86_64-linux using ISL-0.15.

2015-09-28  Sebastian Pop  <s.pop@samsung.com>
	Aditya Kumar  <aditya.k7@samsung.com>

	PR tree-optimization/67754
	* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call
	scev analysis on the same loop nest as analyze_drs_in_stmts.
	* graphite-sese-to-poly.c (outermost_loop_in_sese_1): Moved and renamed...
	(try_generate_gimple_bb): Call outermost_loop_in_sese.
	(analyze_drs_in_stmts): Same.
	* sese.c (outermost_loop_in_sese): ...here.

Co-Authored-By: Aditya Kumar <aditya.k7@samsung.com>

From-SVN: r228347
2015-10-01 15:17:58 +00:00
Sebastian Pop da68b8f4d2 remove dead code of commutative_reductions
This code is not used anymore after we removed the previous loop optimizer (not
based on the ISL scheduler.)  We will add back the detection of commutative
reductions after we improve the code generation of scalar dependences (by not
going out of SSA for scalar dependences just to expose them to the data
dependence graph.)

Patch passed bootstrap and check on x86_64-linux with ISL-0.15.

2015-09-29  Sebastian Pop  <s.pop@samsung.com>
            Aditya Kumar  <aditya.k7@samsung.com>

            * graphite-sese-to-poly.c (gsi_for_phi_node): Remove.
            (nb_data_writes_in_bb): Remove.
            (split_pbb): Remove.
            (split_reduction_stmt): Remove.
            (is_reduction_operation_p): Remove.
            (phi_contains_arg): Remove.
            (follow_ssa_with_commutative_ops): Remove.
            (detect_commutative_reduction_arg): Remove.
            (detect_commutative_reduction_assign): Remove.
            (follow_inital_value_to_phi): Remove.
            (edge_initial_value_for_loop_phi): Remove.
            (initial_value_for_loop_phi): Remove.
            (used_outside_reduction): Remove.
            (detect_commutative_reduction): Remove.
            (translate_scalar_reduction_to_array_for_stmt): Remove.
            (remove_phi): Remove.
            (dr_indices_valid_in_loop): Remove.
            (close_phi_written_to_memory): Remove.
            (translate_scalar_reduction_to_array): Remove.
            (rewrite_commutative_reductions_out_of_ssa_close_phi): Remove.
            (rewrite_commutative_reductions_out_of_ssa_loop): Remove.
            (rewrite_commutative_reductions_out_of_ssa): Remove.
            (build_poly_scop): Remove call to rewrite_commutative_reductions_out_of_ssa.

Co-Authored-By: Aditya Kumar <aditya.k7@samsung.com>

From-SVN: r228255
2015-09-29 16:33:45 +00:00
Aditya Kumar d5b5a232d4 re PR tree-optimization/67700 ([graphite] miscompile due to wrong codegen)
fix PR67700

The patch makes the detection of scop parameters in parameter_index_in_region a
bit more conservative by discarding scalar variables defined in function of data
references defined in the scop.

2015-09-25  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                PR tree-optimization/67700
                * graphite-sese-to-poly.c (parameter_index_in_region): Call
                invariant_in_sese_p_rec.
                (extract_affine): Same.
                (rewrite_cross_bb_scalar_deps): Call update_ssa.
                * sese.c (invariant_in_sese_p_rec): Export.  Handle vdefs and vuses.
                * sese.h (invariant_in_sese_p_rec): Declare.

                * testsuite/gcc.dg/graphite/run-id-pr67700.c: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228214
2015-09-28 17:29:59 +00:00
Trevor Saunders 355fe0884b switch from gimple to gimple*
This renames the gimple_statement_base struct to gimple removes the
typedef of gimple_statement_base * to gimple, and then adjusts all of
the places that use the type.

gcc/ChangeLog:

2015-09-19  Trevor Saunders  <tbsaunde@tbsaunde.org>

	* coretypes.h (gimple): Change typedef to be a forward
	declaration.
	* gimple.h (gimple_statement_base): rename to gimple.
	* (all functions and types using gimple): Adjust.
	* *.[ch]: Likewise.

gcc/cp/ChangeLog:

2015-09-19  Trevor Saunders  <tbsaunde@tbsaunde.org>

	* cp-gimplify.c (gimplify_must_not_throw_expr): Adjust.

From-SVN: r227941
2015-09-20 00:52:59 +00:00
Sebastian Pop d6bb5ccfeb remove -floop-* flags
2015-08-27  Sebastian Pop  <s.pop@samsung.com>

	* Makefile.in (OBJS): Remove graphite-blocking.o and
	graphite-interchange.o.
	* common.opt (floop-strip-mine, floop-interchange, floop-block):
	Alias of floop-nest-optimize.
	* doc/invoke.texi (floop-strip-mine, floop-interchange, floop-block):
	Document as alias of -floop-nest-optimize.
	* graphite-blocking.c: Remove.
	* graphite-interchange.c: Remove.
	* graphite-optimize-isl.c: Include dumpfile.h.
	(getScheduleForBand): Add dump for tiled loops.  Use
	PARAM_LOOP_BLOCK_TILE_SIZE instead of hard coded constant.
	* graphite-poly.c (scop_max_loop_depth): Remove.
	(print_scattering_function_1): Remove.
	(print_scattering_function): Remove.
	(print_scattering_functions): Remove.
	(debug_scattering_function): Remove.
	(debug_scattering_functions): Remove.
	(apply_poly_transforms): Remove use of flag_loop_block,
	flag_loop_strip_mine, and flag_loop_interchange.
	(new_poly_bb): Remove use of PBB_TRANSFORMED, PBB_SAVED, and
	PBB_ORIGINAL.
	(print_pdr_access_layout): Remove.
	(print_pdr): Print ISL representation.
	(new_scop): Remove use of SCOP_ORIGINAL_SCHEDULE,
	SCOP_TRANSFORMED_SCHEDULE, and SCOP_SAVED_SCHEDULE.
	(free_scop): Same.
	(openscop_print_pbb_domain): Remove.
	(print_pbb): Remove call to print_scattering_function.
	(openscop_print_scop_context): Remove.
	(print_scop_context): Do not print matrices anymore.
	(print_scop): Do not print SCOP_ORIGINAL_SCHEDULE and
	SCOP_TRANSFORMED_SCHEDULE.
	(print_isl_set): Add printing of a new line.
	(print_isl_map): Same.
	(print_isl_aff): Same.
	(print_isl_constraint): Same.
	(loop_to_lst): Remove.
	(scop_to_lst): Remove.
	(lst_indent_to): Remove.
	(print_lst): Remove.
	(debug_lst): Remove.
	(dot_lst_1): Remove.
	(dot_lst): Remove.
	(reverse_loop_at_level): Remove.
	(reverse_loop_for_pbbs): Remove.
	* graphite-poly.h (pdr_dim_iter_domain): Remove.
	(pdr_nb_params): Remove.
	(pdr_alias_set_dim): Remove.
	(pdr_subscript_dim): Remove.
	(pdr_iterator_dim): Remove.
	(pdr_parameter_dim): Remove.
	(same_pdr_p): Remove.
	(struct poly_scattering): Remove.
	(struct poly_bb): Remove _original, _transformed, _saved.
	(PBB_DOMAIN, PBB_ORIGINAL, PBB_ORIGINAL_SCATTERING): Remove.
	(PBB_TRANSFORMED, PBB_TRANSFORMED_SCATTERING, PBB_SAVED): Remove.
	(PBB_NB_LOCAL_VARIABLES): Remove.
	(PBB_NB_SCATTERING_TRANSFORM): Remove.
	(schedule_to_scattering): Remove.
	(number_of_write_pdrs): Remove.
	(pbb_dim_iter_domain): Remove.
	(pbb_nb_params): Remove.
	(pbb_nb_scattering_orig): Remove.
	(pbb_nb_scattering_transform): Remove.
	(pbb_nb_dynamic_scattering_transform): Remove.
	(pbb_nb_local_vars): Remove.
	(pbb_iterator_dim): Remove.
	(pbb_parameter_dim): Remove.
	(psco_scattering_dim): Remove.
	(psct_scattering_dim): Remove.
	(psct_local_var_dim): Remove.
	(psco_iterator_dim): Remove.
	(psct_iterator_dim): Remove.
	(psco_parameter_dim): Remove.
	(psct_parameter_dim): Remove.
	(psct_dynamic_dim): Remove.
	(psct_static_dim): Remove.
	(psct_add_local_variable): Remove.
	(new_lst_loop): Remove.
	(new_lst_stmt): Remove.
	(free_lst): Remove.
	(copy_lst): Remove.
	(lst_add_loop_under_loop): Remove.
	(lst_depth): Remove.
	(lst_dewey_number): Remove.
	(lst_dewey_number_at_depth): Remove.
	(lst_pred): Remove.
	(lst_succ): Remove.
	(lst_find_pbb): Remove.
	(find_lst_loop): Remove.
	(lst_find_first_pbb): Remove.
	(lst_empty_p): Remove.
	(lst_find_last_pbb): Remove.
	(lst_contains_p): Remove.
	(lst_contains_pbb): Remove.
	(lst_create_nest): Remove.
	(lst_remove_from_sequence): Remove.
	(lst_remove_loop_and_inline_stmts_in_loop_father): Remove.
	(lst_niter_for_loop): Remove.
	(pbb_update_scattering): Remove.
	(lst_update_scattering_under): Remove.
	(lst_update_scattering): Remove.
	(lst_insert_in_sequence): Remove.
	(lst_replace): Remove.
	(lst_substitute_3): Remove.
	(lst_distribute_lst): Remove.
	(lst_remove_all_before_including_pbb): Remove.
	(lst_remove_all_before_excluding_pbb): Remove.
	(struct scop): Remove original_schedule, transformed_schedule, and
	saved_schedule.
	(SCOP_ORIGINAL_SCHEDULE, SCOP_TRANSFORMED_SCHEDULE): Remove.
	(SCOP_SAVED_SCHEDULE): Remove.
	(poly_scattering_new): Remove.
	(poly_scattering_free): Remove.
	(poly_scattering_copy): Remove.
	(store_scattering_pbb): Remove.
	(store_lst_schedule): Remove.
	(restore_lst_schedule): Remove.
	(store_scattering): Remove.
	(restore_scattering_pbb): Remove.
	(restore_scattering): Remove.
	* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
	Remove scattering_dimensions.  Do not use pbb_dim_iter_domain:
	compute the scattering polyhedron dimension from the dimension of
	pbb->domain.
	(build_scop_scattering): Update call to
	build_pbb_scattering_polyhedrons.
	(build_poly_scop): Remove call to scop_to_lst.
	* graphite.c (graphite_transform_loops): Add call to print_scop.
	(gate_graphite_transforms): Remove use of flag_loop_block,
	flag_loop_interchange, and flag_loop_strip_mine.

testsuite/

	* gcc.dg/graphite/graphite.exp (interchange_files, block_files):
	Replaced by opt_files, compile with -floop-nest-optimize.
	* g++.dg/graphite/graphite.exp: Same.
	* gfortran.dg/graphite/graphite.exp: Same.
	* gcc.dg/graphite/block-0.c: Adjust pattern.
	* gcc.dg/graphite/block-1.c: Same.
	* gcc.dg/graphite/block-3.c: Same.
	* gcc.dg/graphite/block-4.c: Same.
	* gcc.dg/graphite/block-5.c: Same.
	* gcc.dg/graphite/block-6.c: Same.
	* gcc.dg/graphite/block-7.c: Same.
	* gcc.dg/graphite/block-8.c: Same.
	* gcc.dg/graphite/block-pr47654.c: Same.
	* gcc.dg/graphite/interchange-0.c: Same.
	* gcc.dg/graphite/interchange-1.c: Same.
	* gcc.dg/graphite/interchange-10.c: Same.
	* gcc.dg/graphite/interchange-11.c: Same.
	* gcc.dg/graphite/interchange-12.c: Same.
	* gcc.dg/graphite/interchange-13.c: Same.
	* gcc.dg/graphite/interchange-14.c: Same.
	* gcc.dg/graphite/interchange-15.c: Same.
	* gcc.dg/graphite/interchange-3.c: Same.
	* gcc.dg/graphite/interchange-4.c: Same.
	* gcc.dg/graphite/interchange-5.c: Same.
	* gcc.dg/graphite/interchange-6.c: Same.
	* gcc.dg/graphite/interchange-7.c: Same.
	* gcc.dg/graphite/interchange-8.c: Same.
	* gcc.dg/graphite/interchange-9.c: Same.
	* gcc.dg/graphite/interchange-mvt.c: Same.
	* gcc.dg/graphite/pr37485.c: Same.
	* gcc.dg/graphite/uns-block-1.c: Same.
	* gcc.dg/graphite/uns-interchange-12.c: Same.
	* gcc.dg/graphite/uns-interchange-14.c: Same.
	* gcc.dg/graphite/uns-interchange-15.c: Same.
	* gcc.dg/graphite/uns-interchange-9.c: Same.
	* gcc.dg/graphite/uns-interchange-mvt.c: Same.
	* gfortran.dg/graphite/interchange-3.f90: Same.

From-SVN: r227277
2015-08-27 19:07:04 +00:00
Aditya Kumar 2a611178d5 Specify the type of scop->region
Changing the type of scop::region from void* to sese, as this is
the only type assigned to scop::region for now. No functional changes intended.
Passes regtest and bootstrap.

gcc/ChangeLog:

2015-08-17  Aditya Kumar  <aditya.k7@samsung.com>

        * graphite-poly.c: Change type of region from void* to sese.
        * graphite-poly.h (struct scop): Changing the type of scop::region
	from void* to sese. Change accessor macro accordingly.
        * graphite-sese-to-poly.c (extract_affine_chrec): Use accessor macro.

From-SVN: r227151
2015-08-24 20:53:51 +00:00
Tom de Vries 805134b917 Allow non-overflow ops in reductions
2015-08-01  Tom de Vries  <tom@codesourcery.com>

	* tree.c (operation_can_overflow, operation_no_trapping_overflow): New
	function.
	* tree.h (operation_can_overflow, operation_no_trapping_overflow):
	Declare.
	* tree-vect-loop.c (vect_is_simple_reduction_1): Use
	operation_no_trapping_overflow.  Allow non-overflow operations.
	* graphite-sese-to-poly.c (is_reduction_operation_p): Allow non-overflow
	operations.

	* gcc.dg/autopar/reduc-2char.c (init_arrays): Mark with attribute
	optimize ("-ftree-parallelize-loops=0").
	Add successful scans for 2 detected reductions.	 Add xfail scans for 3
	detected reductions.
	* gcc.dg/autopar/reduc-2short.c: Same.
	* gcc.dg/autopar/reduc-8.c (init_arrays): Mark with attribute
	optimize ("-ftree-parallelize-loops=0").  Add successful scans for 2
	detected reductions.
	* gcc.dg/vect/trapv-vect-reduc-4.c: Update scan to match vectorized min
	and max reductions.

From-SVN: r226463
2015-08-01 08:29:29 +00:00
Tom de Vries 5fed2e0d17 Enable reductions without fassociative-math in graphite
2015-07-24  Tom de Vries  <tom@codesourcery.com>

	* graphite-sese-to-poly.c (build_poly_scop): Always call
	rewrite_commutative_reductions_out_of_ssa.

From-SVN: r226194
2015-07-24 20:55:31 +00:00
Tom de Vries e6df850973 Don't allow unsafe reductions in graphite
2015-07-24  Tom de Vries  <tom@codesourcery.com>

	* graphite-sese-to-poly.c (is_reduction_operation_p): Limit
	flag_associative_math to FLOAT_TYPE_P.  Honour
	TYPE_OVERFLOW_WRAPS for INTEGRAL_TYPE_P. Don't allow any other types.

	* gcc.dg/graphite/block-1.c: Xfail scan.
	* gcc.dg/graphite/interchange-12.c: Same.
	* gcc.dg/graphite/interchange-14.c: Same.
	* gcc.dg/graphite/interchange-15.c: Same.
	* gcc.dg/graphite/interchange-9.c: Same.
	* gcc.dg/graphite/interchange-mvt.c: Same.
	* gcc.dg/graphite/uns-block-1.c: New test.
	* gcc.dg/graphite/uns-interchange-12.c: New test.
	* gcc.dg/graphite/uns-interchange-14.c: New test.
	* gcc.dg/graphite/uns-interchange-15.c: New test.
	* gcc.dg/graphite/uns-interchange-9.c: New test.
	* gcc.dg/graphite/uns-interchange-mvt.c: New test.

From-SVN: r226193
2015-07-24 20:55:22 +00:00