Commit Graph

170 Commits

Author SHA1 Message Date
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Richard Biener b2bf825892 re PR tree-optimization/85935 ([graphite] ICE in extract_affine, at graphite-sese-to-poly.c:287)
2018-06-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/85935
	* graphite-scop-detection.c (find_params_in_bb): Analyze
	condition operands with respect to the correct loop.  Assert
	the analysis doesn't fail.

	* gcc.dg/graphite/pr85935.c: New testcase.

From-SVN: r261263
2018-06-07 07:01:56 +00:00
Richard Biener 0e0e545fc6 re PR tree-optimization/84584 ([graphite] ICE: Segmentation fault (in dominated_by_p))
2018-02-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84584
	* graphite-scop-detection.c (scop_detection::add_scop): Discard
	SCoPs with fake exit edge.

	* gcc.dg/graphite/pr84584.c: New testcase.

From-SVN: r258070
2018-02-28 15:33:33 +00:00
Richard Biener c16d3e3c87 re PR libgomp/84466 (libgomp.graphite/force-parallel-8.c fails starting with r257723)
2018-02-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84466
	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
	Adjust last change to less strictly validate use operands.

From-SVN: r258035
2018-02-27 14:45:46 +00:00
Richard Biener 4cf55739fd re PR tree-optimization/84399 ([graphite] ICE in set_codegen_error, at graphite-isl-ast-to-gimple.c:206)
2018-02-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84399
	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
	For operands we can analyze at their definition make sure we can
	analyze them at each use as well.

	* gcc.dg/graphite/pr84399.c: New testcase.

From-SVN: r257723
2018-02-16 08:16:17 +00:00
Richard Biener e4c7306692 re PR tree-optimization/84204 ([graphite] ICE in set_codegen_error, at graphite-isl-ast-to-gimple.c:206)
2018-02-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84204
	* tree-chrec.c (chrec_fold_plus_1): Remove size limiting in
	this place.

	* gcc.dg/graphite/pr84204.c: New testcase.

	PR tree-optimization/84205
	* graphite-isl-ast-to-gimple.c (binary_op_to_tree): Also
	special-case isl_ast_op_zdiv_r.

	* gcc.dg/graphite/pr84205.c: New testcase.

	PR tree-optimization/84223
	* graphite-scop-detection.c (gather_bbs::before_dom_children):
	Only add conditions from within the region.
	(gather_bbs::after_dom_children): Adjust.

	* gfortran.dg/graphite/pr84223.f90: New testcase.

From-SVN: r257441
2018-02-07 10:14:25 +00:00
David Malcolm 9972bbbcbf -Warray-bounds: Fix false positive in some "switch" stmts (PR tree-optimization/83510)
PR tree-optimization/83510 reports that r255649 (for
PR tree-optimization/83312) introduced a false positive for
-Warray-bounds for array accesses within certain switch statements:
those for which value-ranges allow more than one case to be reachable,
but for which one or more of the VR-unreachable cases contain
out-of-range array accesses.

In the reproducer, after the switch in f is inlined into g, we have 3 cases
for the switch (case 9, case 10-19, and default), within a loop that
ranges from 0..9.

With both the old and new code, vr_values::simplify_switch_using_ranges clears
the EDGE_EXECUTABLE flag on the edge to the "case 10-19" block.  This
happens during the dom walk within the substitute_and_fold_engine.

With the old code, the clearing of that EDGE_EXECUTABLE flag led to the
      /* Skip blocks that were found to be unreachable.  */
code in the old implementation of vrp_prop::check_all_array_refs skipping
the "case 10-19" block.

With the new code, we have a second dom walk, and that dom_walker's ctor
sets all edges to be EDGE_EXECUTABLE, losing that information.

Then, dom_walker::before_dom_children (here, the subclass'
check_array_bounds_dom_walker::before_dom_children) can return one edge, if
there's a unique successor edge, and dom_walker::walk filters the dom walk
to just that edge.

Here we have two VR-valid edges (case 9 and default), and an VR-invalid
successor edge (case 10-19).  There's no *unique* valid successor edge,
and hence taken_edge is NULL, and the filtering in dom_walker::walk
doesn't fire.

Hence we've lost the filtering of the "case 10-19" BB, hence the false
positive.

The issue is that we have two dom walks: first within vr_values'
substitute_and_fold_dom_walker (which has skip_unreachable_blocks == false),
then another within vrp_prop::check_all_array_refs (with
skip_unreachable_blocks == true).

Each has different "knowledge" about ruling out edges due to value-ranges,
but we aren't combining that information.  The former "knows" about
out-edges at a particular control construct (e.g. at a switch), the latter
"knows" about dominance, but only about unique successors (hence the
problem when two out of three switch cases are valid).

This patch combines the information by preserving the EDGE_EXECUTABLE
flags from the first dom walk, and using it in the second dom walk,
potentially rejecting additional edges.

Doing so fixes the false positive.

I attempted an alternative fix, merging the two dom walks into one, but
that led to crashes in identify_jump_threads, so I went with this, as
a less invasive fix.

gcc/ChangeLog:
	PR tree-optimization/83510
	* domwalk.c (set_all_edges_as_executable): New function.
	(dom_walker::dom_walker): Convert bool param
	"skip_unreachable_blocks" to enum reachability.  Move setup of
	edge flags to set_all_edges_as_executable and only do it when
	reachability is REACHABLE_BLOCKS.
	* domwalk.h (enum dom_walker::reachability): New enum.
	(dom_walker::dom_walker): Convert bool param
	"skip_unreachable_blocks" to enum reachability.
	(set_all_edges_as_executable): New decl.
	* graphite-scop-detection.c  (gather_bbs::gather_bbs): Convert
	from false for "skip_unreachable_blocks" to ALL_BLOCKS for
	"reachability".
	* tree-ssa-dom.c (dom_opt_dom_walker::dom_opt_dom_walker): Likewise,
	but converting true to REACHABLE_BLOCKS.
	* tree-ssa-sccvn.c (sccvn_dom_walker::sccvn_dom_walker): Likewise.
	* tree-vrp.c
	(check_array_bounds_dom_walker::check_array_bounds_dom_walker):
	Likewise, but converting it to REACHABLE_BLOCKS_PRESERVING_FLAGS.
	(vrp_dom_walker::vrp_dom_walker): Likewise, but converting it to
	REACHABLE_BLOCKS.
	(vrp_prop::vrp_finalize): Call set_all_edges_as_executable
	if check_all_array_refs will be called.

gcc/testsuite/ChangeLog:
	PR tree-optimization/83510
	* gcc.c-torture/compile/pr83510.c: New test case.

From-SVN: r256980
2018-01-23 11:10:47 +00:00
Richard Biener 950d1cd9ba re PR tree-optimization/83963 ([graphite] ICE in merge_sese, at graphite-scop-detection.c:517)
2018-01-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83963
	* graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
	Properly terminate dominator walk when crossing the exit edge not
	when visiting its source block.

	* gfortran.dg/graphite/pr83963.f: New testcase.
	* gcc.dg/graphite/pr83963-2.c: Likewise.

From-SVN: r256973
2018-01-23 08:00:20 +00:00
Richard Biener 1dba94d42c re PR tree-optimization/83963 ([graphite] ICE in merge_sese, at graphite-scop-detection.c:517)
2018-01-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83963
	* graphite-scop-detection.c (scop_detection::get_sese): Delay
	including the loop exit block.
	(scop_detection::merge_sese): Likewise.
	(scop_detection::add_scop): Do it here instead.

	* gcc.dg/graphite/pr83963.c: New testcase.

From-SVN: r256943
2018-01-22 13:10:57 +00:00
Richard Biener 7467ab4232 re PR tree-optimization/83887 ([graphite] ICE in verify_dominators, at dominance.c:1184 (error: dominator of 3 should be 21, not 18))
2018-01-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83887
	* graphite-scop-detection.c
	(scop_detection::get_nearest_dom_with_single_entry): Remove.
	(scop_detection::get_nearest_pdom_with_single_exit): Likewise.
	(scop_detection::merge_sese): Re-implement with a flood-fill
	algorithm that properly finds a SESE region if it exists.

	* gcc.dg/graphite/pr83887.c: New testcase.
	* gfortran.dg/graphite/pr83887.f90: Likewise.
	* gfortran.dg/graphite/pr83887.f: Likewise.

From-SVN: r256841
2018-01-18 10:59:33 +00:00
Richard Biener b0bd3e52c1 re PR tree-optimization/83435 (ICE in set_value_range, at tree-vrp.c:211)
2018-01-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83435
	* graphite.c (canonicalize_loop_form): Ignore fake loop exit edges.
	* graphite-scop-detection.c (scop_detection::get_sese): Likewise.
	* tree-vrp.c (add_assert_info): Drop TREE_OVERFLOW if they appear.

	* gcc.dg/graphite/pr83435.c: New testcase.

From-SVN: r256535
2018-01-11 13:42:29 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Richard Biener a365945b40 re PR tree-optimization/83385 ([graphite] Wrong code w/ -O1 -floop-nest-optimize)
2017-12-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83385
	* graphite-scop-detection.c (get_order, order): Remove.
	(bb_to_rpo): New global.
	(cmp_pbbs): Adjust.
	(build_scops): Sort pbbs in RPO order.

	* gcc.dg/graphite/pr83385.c: New testcase.

From-SVN: r255579
2017-12-12 12:15:38 +00:00
Richard Biener 5d66d3f151 re PR tree-optimization/83238 ([graphite] ICE in graphite_can_represent_scev, at graphite-scop-detection.c:971)
2017-12-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83238
	* graphite-scop-detection.c (scop_detection::merge_sese): Make
	code match comment, rejecting invalid SESE regions.

	* gcc.dg/graphite/pr83238.c: New testcase.

From-SVN: r255375
2017-12-04 08:26:18 +00:00
Jakub Jelinek 5de73c050e spellcheck-tree.c (test_find_closest_identifier): Use ; instead of ;;.
* spellcheck-tree.c (test_find_closest_identifier): Use ; instead
	of ;;.
	* gengtype-state.c (read_state_pair): Likewise.
	* gimple-fold.c (gimple_fold_builtin_string_compare): Likewise.
	* sel-sched-dump.c (dump_insn_rtx_1): Likewise.
	* ipa-cp.c (intersect_aggregates_with_edge): Likewise.
	* ifcvt.c (noce_try_store_flag_constants): Likewise.
	* tree-ssa-ccp.c (ccp_finalize): Likewise.
	* omp-grid.c (grid_process_kernel_body_copy): Likewise.
	* builtins.c (fold_builtin_3): Likewise.
	* graphite-scop-detection.c
	(scop_detection::stmt_has_simple_data_refs_p): Likewise.
	* hsa-gen.c (hsa_function_representation::hsa_function_representation):
	Likewise.
c/
	* c-parser.c (c_parser_postfix_expression): Use ; instead of ;;.
jit/
	* jit-recording.c
	(recording::memento_of_new_rvalue_from_const <long>::write_reproducer):
	Use ; instead of ;;.
lto/
	* lto.c (create_subid_section_table): Use ; instead of ;;.
objc/
	* objc-next-runtime-abi-01.c (generate_dispatch_table): Use ; instead
	of ;;.

From-SVN: r255284
2017-11-30 23:47:51 +01:00
Tom de Vries f9c1b67a39 [graphite] Remove semicolon after do {} while (0) in DEBUG_PRINT
2017-11-05  Tom de Vries  <tom@codesourcery.com>

	PR other/82784
	* graphite-scop-detection.c (DEBUG_PRINT): Remove semicolon after
	"do {} while (0)".

From-SVN: r254421
2017-11-05 09:57:43 +00:00
Richard Biener 04612f7f84 graphite-isl-ast-to-gimple.c (gcc_expression_from_isl_ast_expr_id): Simplify with removal of the parameter rename map.
2017-10-18  Richard Biener  <rguenther@suse.de>

	* graphite-isl-ast-to-gimple.c (gcc_expression_from_isl_ast_expr_id):
	Simplify with removal of the parameter rename map.
	(set_rename): Likewise.
	(should_copy_to_new_region): Likewise.
	(graphite_copy_stmts_from_block): Likewise.
	(copy_bb_and_scalar_dependences): Remove initialization of
	unused copied_bb_map.
	(copy_def): Remove.
	(copy_internal_parameters): Likewise.
	(graphite_regenerate_ast_isl): Do not call copy_internal_parameters.
	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
	Use INTEGRAL_TYPE_P.
	(parameter_index_in_region_1): Rename to ...
	(assign_parameter_index_in_region): ... this.  Assert we have
	a parameter we handle.
	(scan_tree_for_params): Adjust.
	* sese.h (parameter_rename_map_t): Remove.
	(struct sese_info_t): Remove unused parameter_rename_map and
	copied_bb_map members.
	* sese.c (new_sese_info): Adjust.
	(free_sese_info): Likewise.

From-SVN: r253847
2017-10-18 08:30:45 +00:00
Richard Biener 92900aec89 2017-10-17 Richard Biener <rguenther@suse.de>
* graphite-scop-detection.c
	(scop_detection::stmt_has_simple_data_refs_p): Always use
	the full nest as region.
	(try_generate_gimple_bb): Likewise.
	* sese.c (scalar_evolution_in_region): Simplify now that
	SCEV can handle instantiation in regions.
	* tree-scalar-evolution.c (instantiate_scev_name): Also instantiate
	in the non-loop part of a function if requested.

From-SVN: r253811
2017-10-17 13:19:51 +00:00
Richard Biener 7ea3a3c759 re PR tree-optimization/82563 ([graphite] ICE in check_loop_closed_ssa_def, at tree-ssa-loop-manip.c:709)
2017-10-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82563
	* graphite-isl-ast-to-gimple.c (generate_entry_out_of_ssa_copies):
	New function.
	(graphite_regenerate_ast_isl): Call it.
	* graphite-scop-detection.c (build_scops): Remove entry edge split.

	* gcc.dg/graphite/pr82563.c: New testcase.

From-SVN: r253809
2017-10-17 13:17:30 +00:00
Richard Biener a68f286ccc re PR tree-optimization/82451 ([GRAPHITE] codegen error in get_rename_from_scev)
2017-10-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82451
	Revert
	2017-10-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82355
	* graphite-isl-ast-to-gimple.c (build_iv_mapping): Also build
	a mapping for the enclosing loop but avoid generating one for
	the loop tree root.
	(copy_bb_and_scalar_dependences): Remove premature codegen
	error on PHIs in blocks duplicated into multiple places.
	* graphite-scop-detection.c
	(scop_detection::stmt_has_simple_data_refs_p): For a loop not
	in the region use it as loop and nest to analyze the DR in.
	(try_generate_gimple_bb): Likewise.
	* graphite-sese-to-poly.c (extract_affine_chrec): Adjust.
	(add_loop_constraints): For blocks in a loop not in the region
	create a dimension with a single iteration.
	* sese.h (gbb_loop_at_index): Remove assert.

	* cfgloop.c (loop_preheader_edge): For the loop tree root
	return the single successor of the entry block.
	* graphite-isl-ast-to-gimple.c (graphite_regenerate_ast_isl):
	Reset the SCEV hashtable and niters.
	* graphite-scop-detection.c
	(scop_detection::graphite_can_represent_scev): Add SCOP parameter,
	assert that we only have POLYNOMIAL_CHREC that vary in loops
	contained in the region.
	(scop_detection::graphite_can_represent_expr): Adjust.
	(scop_detection::stmt_has_simple_data_refs_p): For loops
	not in the region set loop to NULL.  The nest is now the
	entry edge to the region.
	(try_generate_gimple_bb): Likewise.
	* sese.c (scalar_evolution_in_region): Adjust for
	instantiate_scev change.
	* tree-data-ref.h (graphite_find_data_references_in_stmt):
	Make nest parameter the edge into the region.
	(create_data_ref): Likewise.
	* tree-data-ref.c (dr_analyze_indices): Make nest parameter an
	entry edge into a region and adjust instantiate_scev calls.
	(create_data_ref): Likewise.
	(graphite_find_data_references_in_stmt): Likewise.
	(find_data_references_in_stmt): Pass the loop preheader edge
	from the nest argument.
	* tree-scalar-evolution.h (instantiate_scev): Make instantiate_below
	parameter the edge into the region.
	(instantiate_parameters): Use the loop preheader edge as entry.
	* tree-scalar-evolution.c (analyze_scalar_evolution): Handle
	NULL loop.
	(get_instantiated_value_entry): Make instantiate_below parameter
	the edge into the region.
	(instantiate_scev_name): Likewise.  Adjust dominance checks,
	when we cannot use loop-based instantiation instantiate by
	walking use-def chains.
	(instantiate_scev_poly): Adjust.
	(instantiate_scev_binary): Likewise.
	(instantiate_scev_convert): Likewise.
	(instantiate_scev_not): Likewise.
	(instantiate_array_ref): Remove.
	(instantiate_scev_3): Likewise.
	(instantiate_scev_2): Likewise.
	(instantiate_scev_1): Likewise.
	(instantiate_scev_r): Do not blindly handle N-operand trees.
	Do not instantiate array-refs.  Handle all constants and invariants.
	(instantiate_scev): Make instantiate_below parameter
	the edge into the region.
	(resolve_mixers): Use the loop preheader edge for the region
	parameter to instantiate_scev_r.
	* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Adjust.

	* gcc.dg/graphite/pr82451.c: New testcase.
	* gfortran.dg/graphite/id-27.f90: Likewise.
	* gfortran.dg/graphite/pr82451.f: Likewise.

From-SVN: r253707
2017-10-13 07:02:55 +00:00
Richard Biener cae827b1a1 graphite-scop-detection.c (loop_ivs_can_be_represented): Remove.
2017-10-13  Richard Biener  <rguenther@suse.de>

	* graphite-scop-detection.c (loop_ivs_can_be_represented): Remove.
	(scop_detection::harmful_loop_in_region): Remove premature
	IV type restriction.
	(scop_detection::graphite_can_represent_scev): We can handle
	pointer IVs just fine.

From-SVN: r253705
2017-10-13 06:57:11 +00:00
Richard Biener bd8d431f44 graphite-isl-ast-to-gimple.c: Include ssa.h and tree-ssa.h.
2017-10-06  Richard Biener  <rguenther@suse.de>

	* graphite-isl-ast-to-gimple.c: Include ssa.h and tree-ssa.h.
	(translate_isl_ast_to_gimple::translate_pending_phi_nodes,
	translate_isl_ast_to_gimple::is_valid_rename,
	translate_isl_ast_to_gimple::get_rename,
	translate_isl_ast_to_gimple::get_def_bb_for_const,
	translate_isl_ast_to_gimple::get_new_name,
	translate_isl_ast_to_gimple::collect_all_ssa_names,
	translate_isl_ast_to_gimple::copy_loop_phi_args,
	translate_isl_ast_to_gimple::collect_all_ssa_names,
	translate_isl_ast_to_gimple::copy_loop_phi_args,
	translate_isl_ast_to_gimple::copy_loop_phi_nodes,
	translate_isl_ast_to_gimple::add_close_phis_to_merge_points,
	translate_isl_ast_to_gimple::add_close_phis_to_outer_loops,
	translate_isl_ast_to_gimple::copy_loop_close_phi_args,
	translate_isl_ast_to_gimple::copy_loop_close_phi_nodes,
	translate_isl_ast_to_gimple::copy_cond_phi_args,
	translate_isl_ast_to_gimple::copy_cond_phi_nodes,
	translate_isl_ast_to_gimple::edge_for_new_close_phis,
	translate_isl_ast_to_gimple::add_phi_arg_for_new_expr,
	translate_isl_ast_to_gimple::rename_uses,
	translate_isl_ast_to_gimple::rename_all_uses): Remove.
	(translate_isl_ast_to_gimple::get_rename_from_scev): Simplify.
	(set_rename_for_each_def): Likewise.
	(graphite_copy_stmts_from_block): Handle debug stmt resetting
	here.  Handle rewriting SCEV analyzable uses here.
	(copy_bb_and_scalar_dependences): Generate code for PHI
	copy-in/outs.
	(graphite_regenerate_ast_isl): Adjust.
	* graphite-scop-detection.c (trivially_empty_bb_p): Move to sese.[ch].
	(add_write, add_read): New functions.
	(build_cross_bb_scalars_def): Use it and simplify.
	(build_cross_bb_scalars_use): Likewise.
	(graphite_find_cross_bb_scalar_vars): Inline into...
	(try_generate_gimple_bb): ...here.  Add dependences for PHIs,
	simulating out-of-SSA.  Compute liveout and add dependencies.
	(build_scops): Force an empty entry block.
	* sese.h (sese_info_t::liveout, sese_info_t::debug_liveout): New
	members.
	(sese_build_liveouts): Declare.
	(sese_trivially_empty_bb_p): Likewise.
	* sese.c (sese_build_liveouts_bb): Properly handle PHIs,
	compute liveout and debug_liveout.
	(sese_bad_liveouts_use): Remove.
	(sese_reset_debug_liveouts_bb): Likewise.
	(sese_reset_debug_liveouts): Rewrite in terms of debug_liveout.
	(sese_build_liveouts): Build liveout and debug_liveout and store
	it in region.
	(new_sese_info): Adjust.
	(free_sese_info): Likewise.
	(sese_insert_phis_for_liveouts): Reset debug stmts from here,
	do not build liveout here.
	(move_sese_in_condition): Adjust region entry.
	(scev_analyzable_p): Match up with chrec_apply requirements.
	(sese_trivially_empty_bb_p): New.
	* tree-into-ssa.c (get_reaching_def): Properly support generating
	default-defs for incremental rewrite of anonymous names.

	* gcc.dg/graphite/id-15.c: No longer expect a code generation error.
	* gcc.dg/graphite/id-16.c: Likewise.
	* gcc.dg/graphite/pr46168.c: Likewise.
	* gcc.dg/graphite/pr68756.c: Likewise.
	* gcc.dg/graphite/pr69728.c: Likewise.
	* gcc.dg/graphite/pr71575-2.c: Likewise.
	* gcc.dg/graphite/pr77362.c: Likewise.
	* gcc.dg/graphite/pr81373.c: Likewise.
	* gcc.dg/graphite/run-id-pr67700-1.c: Likewise.
	* gfortran.dg/graphite/interchange-1.f: Likewise.
	* gfortran.dg/graphite/pr42334-1.f: Likewise.
	* gfortran.dg/graphite/pr42393-1.f90: Likewise.
	* gfortran.dg/graphite/pr42393.f90: Likewise.
	* gfortran.dg/graphite/pr47019.f: Likewise.
	* gfortran.dg/graphite/id-17.f: Likewise.
	* gfortran.dg/graphite/id-19.f: Likewise.
	* gfortran.dg/graphite/run-id-2.f90: Likewise.
	* gfortran.dg/graphite/pr42326-1.f90: Likewise.
	* gfortran.dg/graphite/pr42326.f90: Likewise.
	* gfortran.dg/graphite/pr68550-2.f90: Likewise.
	* gfortran.dg/graphite/pr29581.f90: Likewise.  No longer expect
	a code generation error.
	* gfortran.dg/graphite/run-id-3.f90: Likewise.
	* gfortran.dg/graphite/pr29832.f90: Likewise.

From-SVN: r253475
2017-10-06 07:06:17 +00:00
Richard Biener 0389d86c4e re PR tree-optimization/82355 (ICE in outermost_loop_in_sese, at sese.c:301)
2017-10-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82355
	* graphite-isl-ast-to-gimple.c (build_iv_mapping): Also build
	a mapping for the enclosing loop but avoid generating one for
	the loop tree root.
	(copy_bb_and_scalar_dependences): Remove premature codegen
	error on PHIs in blocks duplicated into multiple places.
	* graphite-scop-detection.c
	(scop_detection::stmt_has_simple_data_refs_p): For a loop not
	in the region use it as loop and nest to analyze the DR in.
	(try_generate_gimple_bb): Likewise.
	* graphite-sese-to-poly.c (extract_affine_chrec): Adjust.
	(add_loop_constraints): For blocks in a loop not in the region
	create a dimension with a single iteration.
	* sese.h (gbb_loop_at_index): Remove assert.

	* gcc.dg/graphite/fuse-1.c: Adjust.
	* gcc.dg/graphite/fuse-2.c: Likewise.
	* gcc.dg/graphite/pr82355.c: New testcase.

From-SVN: r253336
2017-10-02 07:32:52 +00:00
Richard Biener 6f0e6f0868 graphite-scop-detection.c (find_scop_parameters): Move loop bound handling ...
2017-09-27  Richard Biener  <rguenther@suse.de>

	* graphite-scop-detection.c (find_scop_parameters): Move
	loop bound handling ...
	(gather_bbs::before_dom_children): ... here, avoiding the need
	to build scop_info->loop_nest.
	(record_loop_in_sese): Remove.
	* sese.h (sese_info_t::loop_nest): Remove.
	* sese.c (new_sese_info): Do not allocate loop_nest.
	(free_sese_info): Do not free loop_nest.

From-SVN: r253232
2017-09-27 14:35:04 +00:00
Richard Biener 99124c31f9 graphite.h (scop::max_alias_set): New member.
2017-09-27  Richard Biener  <rguenther@suse.de>

	* graphite.h (scop::max_alias_set): New member.
	* graphite-scop-detection.c: Remove references to non-existing
	--param in comments.
	(build_alias_sets): Record the maximum alias set used for drs.
	(build_scops): Support zero as unlimited for
	--param graphite-max-arrays-per-scop.
	* graphite-sese-to-poly.c (add_scalar_version_numbers): Remove
	and inline into ...
	(build_poly_sr_1): ... here.  Compute alias set based on the
	maximum alias set used for drs rather than
	PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP

From-SVN: r253229
2017-09-27 13:06:34 +00:00
Richard Biener d2552094b8 invoke.texi (graphite-max-bbs-per-function): Remove.
2017-09-27  Richard Biener  <rguenther@suse.de>

	* doc/invoke.texi (graphite-max-bbs-per-function): Remove.
	(graphite-max-nb-scop-params): Document special value zero.
	* domwalk.h (dom_walker::STOP): New symbolical constant.
	(dom_walker::dom_walker): Add optional parameter for bb to
	RPO mapping.
	(dom_walker::~dom_walker): Declare.
	(dom_walker::before_dom_children): Document STOP return value.
	(dom_walker::m_user_bb_to_rpo): New member.
	(dom_walker::m_bb_to_rpo): Likewise.
	* domwalk.c (dom_walker::dom_walker): Compute bb to RPO
	mapping here if not provided by the user.
	(dom_walker::~dom_walker): Free bb to RPO mapping if not
	provided by the user.
	(dom_walker::STOP): Define.
	(dom_walker::walk): Do not compute bb to RPO mapping here.
	Support STOP return value from before_dom_children to stop
	walking.
	* graphite-optimize-isl.c (optimize_isl): If the schedule
	is the same still generate code if -fgraphite-identity
	or -floop-parallelize-all are given.
	* graphite-scop-detection.c: Include cfganal.h.
	(gather_bbs::gather_bbs): Get and pass through bb to RPO
	mapping.
	(gather_bbs::before_dom_children): Return STOP for BBs
	not in the region.
	(build_scops): Compute bb to RPO mapping and pass it to
	the domwalk.  Treat --param graphite-max-nb-scop-params=0
	as not limiting the number of params.
	* graphite.c (graphite_initialize): Remove limit on the
	number of basic-blocks in a function.
	* params.def (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION): Remove.
	(PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS): Adjust to documented
	default value of 10.

From-SVN: r253226
2017-09-27 11:09:41 +00:00
Richard Biener ca617fd214 graphite-scop-detection.c (scop_detection::build_scop_depth): Rewrite, fold in ...
2017-09-26  Richard Biener  <rguenther@suse.de>

	* graphite-scop-detection.c (scop_detection::build_scop_depth): Rewrite,
	fold in ...
	(scop_detection::build_scop_breadth): ... this.  Removed.
	(scop_detection::loop_is_valid_in_scop): Fold into single caller.
	(scop_detection::harmful_stmt_in_bb): Likewise.
	(scop_detection::graphite_can_represent_stmt): Likewise.
	(scop_detection::loop_body_is_valid_scop): Likewise.  Remove recursion.
	(scop_detection::can_represent_loop): Remove recursion, fold in ...
	(scop_detection::can_represent_loop_1): ... this.  Removed.
	(scop_detection::harmful_loop_in_region): Simplify after inlining
	the above and remove more quadraticness.
	(build_scops): Adjust.
	* tree-data-ref.c (loop_nest_has_data_refs): Remove pointless
	quadraticness.

From-SVN: r253203
2017-09-26 14:28:13 +00:00
Richard Biener ab0e530848 graphite-isl-ast-to-gimple.c (translate_pending_phi_nodes): Verify both BBs contain loop PHI nodes before dispatching to copy_loop_phi_args.
2017-09-21  Richard Biener  <rguenther@suse.de>

	* graphite-isl-ast-to-gimple.c (translate_pending_phi_nodes):
	Verify both BBs contain loop PHI nodes before dispatching to
	copy_loop_phi_args.
	(graphite_regenerate_ast_isl): Do not recompute dominators,
	do not verify three times.  Restructure for clarity.
	* graphite-scop-detection.c (same_close_phi_node,
	remove_duplicate_close_phi, make_close_phi_nodes_unique,
	defined_in_loop_p, canonicalize_loop_closed_ssa,
	canonicalize_loop_closed_ssa_form): Simplify, remove excess
	checking and SSA rewrite, move to ...
	* graphite.c: ... here.  Include ssa.h and tree-ssa-loop-manip.h.
	(graphite_initialize): Do not pass in ctx, do not reset the
	SCEV cache, compute only dominators.
	(graphite_transform_loops): Allocate ISL ctx after
	graphite_initialize.  Call canonicalize_loop_closed_ssa_form.
	Maintain post-dominators only around build_scops.
	* sese.c (if_region_set_false_region): Make static.  Free
	and recompute dominators.
	(move_sese_in_condition): Assert we don't get called with
	post-dominators computed.
	* sese.h (if_region_set_false_region): Remove.

From-SVN: r253090
2017-09-22 07:31:32 +00:00
Richard Biener 3c16e99cf7 re PR tree-optimization/80213 (ICE in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:704)
2017-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80213
	* graphite-scop-detection.c (trivially_empty_bb_p): Labels
	are allowed in empty BBs as well.
	(canonicalize_loop_closed_ssa): Also look for other complex
	edges.
	(scop_detection::get_sese): Include the loop-closed PHI block
	in loop SESEs.
	(scop_detection::merge_sese): Remove code adding extra blocks.
	(scop_detection::region_has_one_loop): Adjust for get_sese changes.
	(build_scops): Assert the final returned scop is invalid.

From-SVN: r253008
2017-09-20 12:08:16 +00:00
Richard Biener 73fe2f3229 re PR tree-optimization/81373 (Graphite ICE in ssa_default_def at gcc/tree-dfa.c:305)
2017-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81373
	* graphite-scop-detection.c (build_cross_bb_scalars_def):
	Force SESE live-out defs to be handled even if they are
	scev_analyzable_p.

	* gcc.dg/graphite/pr81373.c: New testcase.

From-SVN: r253000
2017-09-20 07:33:58 +00:00
Richard Biener 129d9dc292 graphite-scop-detection.c (scop_detection::can_represent_loop): Do not iterate to sibling loops but only to siblings of inner loops.
2017-09-19  Richard Biener  <rguenther@suse.de>

	* graphite-scop-detection.c (scop_detection::can_represent_loop):
	Do not iterate to sibling loops but only to siblings of inner
	loops.

From-SVN: r252962
2017-09-19 07:14:12 +00:00
Richard Biener 72b03fde35 graphite-scop-detection.c (scop_detection::stmt_has_simple_data_ref): Simplify.
2017-09-18  Richard Biener  <rguenther@suse.de>

	* graphite-scop-detection.c (scop_detection::stmt_has_simple_data_ref):
	Simplify.
	(build_alias_set): Reject aliases with no access function.

From-SVN: r252906
2017-09-18 07:38:12 +00:00
Richard Biener 3d07d963f6 re PR tree-optimization/79622 (Wrong code w/ -O2 -floop-nest-optimize)
2017-09-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79622
	* graphite-scop-detection.c (build_cross_bb_scalars_def): Properly
	handle PHIs.
	(build_cross_bb_scalars_use): Likewise.

	* gcc.dg/graphite/pr79622.c: New testcase.

From-SVN: r252905
2017-09-18 07:34:04 +00:00
Richard Biener b6ab6ef81c re PR tree-optimization/68823 ([graphite] tramp3d-v4 compiled with -floop-nest-optimize crashes)
2017-09-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68823
	* graphite-scop-detection.c (build_alias_set): If we have a
	possible dependence check whether we can handle them by just
	looking at the DRs DR_ACCESS_FNs.
	(build_scops): If build_alias_set fails, fail the SCOP.

From-SVN: r252780
2017-09-15 07:03:02 +00:00
Richard Biener 6d1115c545 re PR tree-optimization/79483 ([graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28))
2017-06-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79483
	* graphite-scop-detection.c (order): New global.
	(get_order): Compute bb to order mapping that satisfies code
	generation constraints.
	(cmp_pbbs): New helper.
	(build_scops): Start domwalk at entry block, sort generated
	pbbs.

	* gcc.dg/graphite/pr79483.c: New testcase.

From-SVN: r249052
2017-06-09 09:36:06 +00:00
Martin Liska 1a81741814 Introduce dump_flags_t type and use it instead of int type.
2017-05-17  Martin Liska  <mliska@suse.cz>

	* class.c (dump_class_hierarchy): Introduce dump_flags_t type and
	use it instead of int type.
	(dump_vtable): Likewise.
	(dump_vtt): Likewise.
	* decl2.c (dump_tu): Likewise.
2017-05-17  Martin Liska  <mliska@suse.cz>

	* c-common.h: Introduce dump_flags_t type and
	use it instead of int type.
	* c-gimplify.c (c_genericize): Likewise.
	* c-opts.c: Likewise.
2017-05-17  Martin Liska  <mliska@suse.cz>

	* c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and
	use it instead of int type.
2017-05-17  Martin Liska  <mliska@suse.cz>

	* cfg.c: Introduce dump_flags_t type and
	use it instead of int type.
	* cfg.h: Likewise.
	* cfghooks.c: Likewise.
	* cfghooks.h (struct cfg_hooks): Likewise.
	* cfgrtl.c: Likewise.
	* cfgrtl.h: Likewise.
	* cgraph.c (cgraph_node::get_body): Likewise.
	* coretypes.h: Likewise.
	* domwalk.c: Likewise.
	* domwalk.h: Likewise.
	* dumpfile.c (struct dump_option_value_info): Likewise.
	(dump_enable_all): Likewise.
	(dump_switch_p_1): Likewise.
	(opt_info_switch_p): Likewise.
	* dumpfile.h (enum tree_dump_index): Likewise.
	(struct dump_file_info): Likewise.
	* genemit.c: Likewise.
	* generic-match-head.c: Likewise.
	* gengtype.c (open_base_files): Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple-pretty-print.h: Likewise.
	* graph.c (print_graph_cfg): Likewise.
	* graphite-scop-detection.c (dot_all_sese): Likewise.
	* ipa-devirt.c (build_type_inheritance_graph): Likewise.
	* loop-unroll.c (report_unroll): Likewise.
	* passes.c (pass_manager::register_one_dump_file): Likewise.
	* print-tree.c: Likewise.
	* statistics.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfg.h: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dfa.h: Likewise.
	* tree-dump.c (dump_function): Likewise.
	* tree-dump.h (struct dump_info): Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-pretty-print.h: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-slp.c: Likewise.

From-SVN: r248140
2017-05-17 09:01:36 +00:00
Martin Liska ef6cb4c716 Add default value for last argument of dump functions.
2017-05-16  Martin Liska  <mliska@suse.cz>

	* parser.c (cp_lexer_print_token): Add default value for flags
	argument of print_gimple_stmt, print_gimple_expr,
	print_generic_stmt and print_generic_expr.
2017-05-16  Martin Liska  <mliska@suse.cz>

	* cgraph.c (cgraph_edge::resolve_speculation): Add default value for flags
	argument of print_gimple_stmt, print_gimple_expr,
	print_generic_stmt and print_generic_expr.
	* cgraphclones.c (symbol_table::materialize_all_clones): Likewise.
	* coretypes.h: Likewise.
	* except.c (dump_eh_tree): Likewise.
	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise.
	* gimple-pretty-print.h: Likewise.
	* gimple-ssa-backprop.c (dump_usage_prefix): Likewise.
	(backprop::push_to_worklist): Likewise.
	(backprop::pop_from_worklist): Likewise.
	(backprop::process_use): Likewise.
	(backprop::intersect_uses): Likewise.
	(note_replacement): Likewise.
	* gimple-ssa-store-merging.c (pass_store_merging::terminate_all_aliasing_chains): Likewise.
	(imm_store_chain_info::coalesce_immediate_stores): Likewise.
	(pass_store_merging::execute): Likewise.
	* gimple-ssa-strength-reduction.c (dump_candidate): Likewise.
	(ssa_base_cand_dump_callback): Likewise.
	(dump_incr_vec): Likewise.
	(replace_refs): Likewise.
	(replace_mult_candidate): Likewise.
	(create_add_on_incoming_edge): Likewise.
	(create_phi_basis): Likewise.
	(insert_initializers): Likewise.
	(all_phi_incrs_profitable): Likewise.
	(introduce_cast_before_cand): Likewise.
	(replace_one_candidate): Likewise.
	* gimplify.c (gimplify_expr): Likewise.
	* graphite-isl-ast-to-gimple.c (is_valid_rename): Likewise.
	(set_rename): Likewise.
	(rename_uses): Likewise.
	(copy_loop_phi_nodes): Likewise.
	(add_close_phis_to_merge_points): Likewise.
	(copy_loop_close_phi_args): Likewise.
	(copy_cond_phi_args): Likewise.
	(graphite_copy_stmts_from_block): Likewise.
	(translate_pending_phi_nodes): Likewise.
	* graphite-poly.c (print_pdr): Likewise.
	(dump_gbb_cases): Likewise.
	(dump_gbb_conditions): Likewise.
	(print_scop_params): Likewise.
	* graphite-scop-detection.c (build_cross_bb_scalars_def): Likewise.
	(build_cross_bb_scalars_use): Likewise.
	(gather_bbs::before_dom_children): Likewise.
	* hsa-dump.c (dump_hsa_immed): Likewise.
	* ipa-cp.c (print_ipcp_constant_value): Likewise.
	(get_replacement_map): Likewise.
	* ipa-inline-analysis.c (dump_condition): Likewise.
	(estimate_function_body_sizes): Likewise.
	* ipa-polymorphic-call.c (check_stmt_for_type_change): Likewise.
	(ipa_polymorphic_call_context::get_dynamic_type): Likewise.
	* ipa-prop.c (ipa_dump_param): Likewise.
	(ipa_print_node_jump_functions_for_edge): Likewise.
	(ipa_modify_call_arguments): Likewise.
	(ipa_modify_expr): Likewise.
	(ipa_dump_param_adjustments): Likewise.
	(ipa_dump_agg_replacement_values): Likewise.
	(ipcp_modif_dom_walker::before_dom_children): Likewise.
	* ipa-pure-const.c (check_stmt): Likewise.
	(pass_nothrow::execute): Likewise.
	* ipa-split.c (execute_split_functions): Likewise.
	* omp-offload.c (dump_oacc_loop_part): Likewise.
	(dump_oacc_loop): Likewise.
	* trans-mem.c (tm_log_emit): Likewise.
	(tm_memopt_accumulate_memops): Likewise.
	(dump_tm_memopt_set): Likewise.
	(dump_tm_memopt_transform): Likewise.
	* tree-cfg.c (gimple_verify_flow_info): Likewise.
	(print_loop): Likewise.
	* tree-chkp-opt.c (chkp_print_addr): Likewise.
	(chkp_gather_checks_info): Likewise.
	(chkp_get_check_result): Likewise.
	(chkp_remove_check_if_pass): Likewise.
	(chkp_use_outer_bounds_if_possible): Likewise.
	(chkp_reduce_bounds_lifetime): Likewise.
	* tree-chkp.c (chkp_register_addr_bounds): Likewise.
	(chkp_mark_completed_bounds): Likewise.
	(chkp_register_incomplete_bounds): Likewise.
	(chkp_mark_invalid_bounds): Likewise.
	(chkp_maybe_copy_and_register_bounds): Likewise.
	(chkp_build_returned_bound): Likewise.
	(chkp_get_bound_for_parm): Likewise.
	(chkp_build_bndldx): Likewise.
	(chkp_get_bounds_by_definition): Likewise.
	(chkp_generate_extern_var_bounds): Likewise.
	(chkp_get_bounds_for_decl_addr): Likewise.
	* tree-chrec.c (chrec_apply): Likewise.
	* tree-data-ref.c (dump_data_reference): Likewise.
	(dump_subscript): Likewise.
	(dump_data_dependence_relation): Likewise.
	(analyze_overlapping_iterations): Likewise.
	* tree-inline.c (expand_call_inline): Likewise.
	(tree_function_versioning): Likewise.
	* tree-into-ssa.c (dump_defs_stack): Likewise.
	(dump_currdefs): Likewise.
	(dump_names_replaced_by): Likewise.
	(dump_update_ssa): Likewise.
	(update_ssa): Likewise.
	* tree-object-size.c (pass_object_sizes::execute): Likewise.
	* tree-parloops.c (build_new_reduction): Likewise.
	(try_create_reduction_list): Likewise.
	(ref_conflicts_with_region): Likewise.
	(oacc_entry_exit_ok_1): Likewise.
	(oacc_entry_exit_single_gang): Likewise.
	* tree-pretty-print.h: Likewise.
	* tree-scalar-evolution.c (set_scalar_evolution): Likewise.
	(get_scalar_evolution): Likewise.
	(add_to_evolution): Likewise.
	(get_loop_exit_condition): Likewise.
	(analyze_evolution_in_loop): Likewise.
	(analyze_initial_condition): Likewise.
	(analyze_scalar_evolution): Likewise.
	(instantiate_scev): Likewise.
	(number_of_latch_executions): Likewise.
	(gather_chrec_stats): Likewise.
	(final_value_replacement_loop): Likewise.
	(scev_const_prop): Likewise.
	* tree-sra.c (dump_access): Likewise.
	(disqualify_candidate): Likewise.
	(create_access): Likewise.
	(reject): Likewise.
	(maybe_add_sra_candidate): Likewise.
	(create_access_replacement): Likewise.
	(analyze_access_subtree): Likewise.
	(analyze_all_variable_accesses): Likewise.
	(sra_modify_assign): Likewise.
	(initialize_constant_pool_replacements): Likewise.
	(find_param_candidates): Likewise.
	(decide_one_param_reduction): Likewise.
	(replace_removed_params_ssa_names): Likewise.
	* tree-ssa-ccp.c (ccp_fold_stmt): Likewise.
	* tree-ssa-copy.c (dump_copy_of): Likewise.
	(copy_prop_visit_cond_stmt): Likewise.
	* tree-ssa-dce.c (mark_operand_necessary): Likewise.
	* tree-ssa-dom.c (pass_dominator::execute): Likewise.
	(record_equivalences_from_stmt): Likewise.
	* tree-ssa-dse.c (compute_trims): Likewise.
	(delete_dead_call): Likewise.
	(delete_dead_assignment): Likewise.
	* tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
	(forward_propagate_into_cond): Likewise.
	(pass_forwprop::execute): Likewise.
	* tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise.
	* tree-ssa-loop-im.c (invariantness_dom_walker::before_dom_children): Likewise.
	(move_computations_worker): Likewise.
	(execute_sm): Likewise.
	* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise.
	(remove_exits_and_undefined_stmts): Likewise.
	(remove_redundant_iv_tests): Likewise.
	* tree-ssa-loop-ivopts.c (dump_use): Likewise.
	(adjust_iv_update_pos): Likewise.
	* tree-ssa-math-opts.c (bswap_replace): Likewise.
	* tree-ssa-phiopt.c (factor_out_conditional_conversion): Likewise.
	(value_replacement): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
	* tree-ssa-pre.c (print_pre_expr): Likewise.
	(get_representative_for): Likewise.
	(create_expression_by_pieces): Likewise.
	(insert_into_preds_of_block): Likewise.
	(eliminate_insert): Likewise.
	(eliminate_dom_walker::before_dom_children): Likewise.
	(eliminate): Likewise.
	(remove_dead_inserted_code): Likewise.
	* tree-ssa-propagate.c (substitute_and_fold): Likewise.
	* tree-ssa-reassoc.c (get_rank): Likewise.
	(eliminate_duplicate_pair): Likewise.
	(eliminate_plus_minus_pair): Likewise.
	(eliminate_not_pairs): Likewise.
	(undistribute_ops_list): Likewise.
	(eliminate_redundant_comparison): Likewise.
	(update_range_test): Likewise.
	(optimize_range_tests_var_bound): Likewise.
	(optimize_vec_cond_expr): Likewise.
	(rewrite_expr_tree): Likewise.
	(rewrite_expr_tree_parallel): Likewise.
	(linearize_expr): Likewise.
	(break_up_subtract): Likewise.
	(linearize_expr_tree): Likewise.
	(attempt_builtin_powi): Likewise.
	(attempt_builtin_copysign): Likewise.
	(transform_stmt_to_copy): Likewise.
	(transform_stmt_to_multiply): Likewise.
	(dump_ops_vector): Likewise.
	* tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Likewise.
	(print_scc): Likewise.
	(set_ssa_val_to): Likewise.
	(visit_reference_op_store): Likewise.
	(visit_use): Likewise.
	(sccvn_dom_walker::before_dom_children): Likewise.
	(run_scc_vn): Likewise.
	* tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise.
	(expr_hash_elt::print): Likewise.
	(const_and_copies::pop_to_marker): Likewise.
	(const_and_copies::record_const_or_copy_raw): Likewise.
	* tree-ssa-structalias.c (compute_dependence_clique): Likewise.
	* tree-ssa-uninit.c (collect_phi_def_edges): Likewise.
	(dump_predicates): Likewise.
	(find_uninit_use): Likewise.
	(warn_uninitialized_phi): Likewise.
	(pass_late_warn_uninitialized::execute): Likewise.
	* tree-ssa.c (verify_vssa): Likewise.
	(verify_ssa): Likewise.
	(maybe_optimize_var): Likewise.
	* tree-vrp.c (dump_value_range): Likewise.
	(dump_all_value_ranges): Likewise.
	(dump_asserts_for): Likewise.
	(register_edge_assert_for_2): Likewise.
	(vrp_visit_cond_stmt): Likewise.
	(vrp_visit_switch_stmt): Likewise.
	(vrp_visit_stmt): Likewise.
	(vrp_visit_phi_node): Likewise.
	(simplify_cond_using_ranges_1): Likewise.
	(fold_predicate_in): Likewise.
	(evrp_dom_walker::before_dom_children): Likewise.
	(evrp_dom_walker::push_value_range): Likewise.
	(evrp_dom_walker::pop_value_range): Likewise.
	(execute_early_vrp): Likewise.

From-SVN: r248113
2017-05-16 14:51:02 +00:00
Richard Biener d721dc3c4b re PR tree-optimization/79977 ([graphite] ICE in outermost_loop_in_sese, at sese.c:300 w/ -O2 -floop-nest-optimize)
2017-03-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79977
	* graphite-scop-detection.c (scop_detection::merge_sese):
	Handle the case of extra exits to blocks dominating the entry.

	* gcc.dg/graphite/pr79977.c: New testcase.

From-SVN: r246006
2017-03-09 16:19:37 +00:00
Richard Biener 9c0c77d279 re PR tree-optimization/69823 (internal compiler error: in create_pw_aff_from_tree, at graphite-sese-to-poly.c:445)
2017-02-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69823
	* graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
	Properly enumerate all BBs in the region.  Use auto_vec/auto_bitmap.

	* gcc.dg/graphite/pr69823.c: New testcase.

From-SVN: r245295
2017-02-09 07:47:07 +00:00
Richard Biener d798497efc re PR tree-optimization/71824 (ICE when compiling libiberty with Graphite loop optimizations)
2017-02-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71824
	* graphite-scop-detection.c (scop_detection::build_scop_breadth):
	Check all loops contained in the merged region.

	* gcc.dg/graphite/pr71824-2.c: New testcase.

From-SVN: r245270
2017-02-08 08:30:48 +00:00
Richard Biener 405a740640 re PR tree-optimization/71824 (ICE when compiling libiberty with Graphite loop optimizations)
2017-02-01  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71824
	* graphite-scop-detection.c (scop_detection::build_scop_breadth):
	Verify the loops are valid in the merged SESE region.
	(scop_detection::can_represent_loop_1): Check analyzing the
	evolution of the number of iterations in the region succeeds.

	* gcc.dg/graphite/pr71824.c: New testcase.

From-SVN: r245081
2017-02-01 08:02:50 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Tom de Vries 5ec4a8cd76 Handle NULL def in build_cross_bb_scalars_def
2016-05-07  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/70956
	* graphite-scop-detection.c (build_cross_bb_scalars_def): Handle NULL
	def.

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

From-SVN: r235994
2016-05-07 06:47:07 +00:00
Tom de Vries 7662b718e1 Add missing single_pred_p test in scop_detection::merge_sese
2016-03-16  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/68715
	* graphite-scop-detection.c (scop_detection::merge_sese): Add missing
	single_pred_p test.

	* gcc.dg/graphite/pr68715-2.c: New test.
	* gcc.dg/graphite/pr68715.c: New test.
	* gfortran.dg/graphite/pr68715.f90: New test.

From-SVN: r234251
2016-03-16 09:19:23 +00:00
Tom de Vries be7ce7aefd Fix same_close_phi_node
2016-03-16  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/68809
	* graphite-scop-detection.c (same_close_phi_node): Test if result types
	are the same.

	* gcc.dg/graphite/pr68809-2.c: New test.
	* gcc.dg/graphite/pr68809.c: New test.

From-SVN: r234250
2016-03-16 09:19:12 +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 b920a04763 fix PR68976: only add loop close phi for names defined in loop
* graphite-isl-ast-to-gimple.c: Fix comment.
        * graphite-scop-detection.c (defined_in_loop_p): New.
        (canonicalize_loop_closed_ssa): Do not add close phi nodes for SSA
        names defined in loop.

gcc/testsuite

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

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

From-SVN: r232658
2016-01-21 02:13:52 +00:00
Aditya Kumar 8f2252625a check for unstructured control flow
* graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
	Discard unstructured if-then-else regions.

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

From-SVN: r232657
2016-01-21 02:13:42 +00:00
Aditya Kumar eaca025e57 fix memory leak in scop-detection
* graphite-scop-detection.c
        (scop_detection::harmful_loop_in_region): Free dom and loops.
        (scop_detection::loop_body_is_valid_scop): Free bbs.

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

From-SVN: r232655
2016-01-21 02:13:24 +00:00
Aditya Kumar 5431c9ea56 record loops in execution order
* graphite-scop-detection.c (record_loop_in_sese): New.
	(gather_bbs::before_dom_children): Call record_loop_in_sese.
	(build_scops): Remove call to build_sese_loop_nests.
	* sese.c (sese_record_loop): Remove.
	(build_sese_loop_nests): Remove.
	(new_sese_info): Remove region->loops.
	(free_sese_info): Same.
	* sese.h (sese_contains_loop): Same.
	(build_sese_loop_nests): Remove.
	(sese_contains_loop): Remove.

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

From-SVN: r232654
2016-01-21 02:13:14 +00:00