Commit 81b822d5 by Sebastian Pop

Fix testsuite/gfortran.dg/graphite/id-4.f90.

2008-12-11  Sebastian Pop  <sebastian.pop@amd.com>

	Fix testsuite/gfortran.dg/graphite/id-4.f90.
	* graphite.c (scan_tree_for_params): Do not compute the multiplicand
	when not needed.

2008-12-11  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite.c (build_scops_1): Initialize open_scop.exit
	and sinfo.last.

2008-12-11  Sebastian Pop  <sebastian.pop@amd.com>
	    Jan Sjodin  <jan.sjodin@amd.com>
            Harsha Jagasia  <harsha.jagasia@amd.com>

	PR middle-end/37852
	PR middle-end/37883
	PR middle-end/37928
	PR middle-end/37980
	PR middle-end/38038
	PR middle-end/38039
	PR middle-end/38073
	PR middle-end/38083
	PR middle-end/38125

	* tree-phinodes.c (remove_phi_nodes): New, extracted from...
	* tree-cfg.c (remove_phi_nodes_and_edges_for_unreachable_block): ...here.
	* tree-flow.h (remove_phi_nodes, canonicalize_loop_ivs): Declared.
	* Makefile.in (graphite.o): Depend on value-prof.h.
	(graphite.o-warn): Removed -Wno-error.
	* tree-parloops.c (canonicalize_loop_ivs): Allow reduction_list 
	to be a NULL pointer.  Call update_stmt.  Return the newly created 
	cannonical induction variable.

	* graphite.h (debug_rename_map): Declared.  Fix some comments.

	* graphite.c: Reimplement the code generation from graphite to gimple.
	Include value-prof.h.
	(loop_iv_stack_get_iv): Do not return NULL for constant substitutions.
	(get_old_iv_from_ssa_name): Removed.
	(graphite_stmt_p): New.
	(new_graphite_bb): Test for useful statements before building a
	graphite statement for the basic block.
	(free_graphite_bb): Do not free GBB_DATA_REFS: this is a bug
	in free_data_ref that calls BITMAP_FREE (DR_VOPS (dr)) without 
	reason.
	(recompute_all_dominators, graphite_verify,
	nb_reductions_in_loop, graphite_loop_normal_form): New.
	(scop_record_loop): Call graphite_loop_normal_form.
	(build_scop_loop_nests): Iterate over all the blocks of the
	function instead of relying on the incomplete information from
	SCOP_BBS.  Return the success of the operation.
	(find_params_in_bb): Use the data from GBB_DATA_REFS.
	(add_bb_domains): Removed.
	(build_loop_iteration_domains): Don't call add_bb_domains.
	Add the iteration domain only to the basic blocks that have been
	translated to graphite.
	(build_scop_conditions_1): Add constraints only if the basic
	block have been translated to graphite.
	(build_scop_data_accesses): Completely disabled until data
	dependence is correctly implemented.
	(debug_rename_elt, debug_rename_map_1, debug_rename_map): New.
	(remove_all_edges_1, remove_all_edges): Removed.
	(get_new_name_from_old_name): New.
	(graphite_rename_variables_in_stmt): Renamed 
	rename_variables_in_stmt.  Call get_new_name_from_old_name.
	Use replace_exp	and update_stmt.
	(is_old_iv): Renamed is_iv.
	(expand_scalar_variables_stmt): Extra parameter for renaming map.
	Use replace_exp	and update_stmt.
	(expand_scalar_variables_expr): Same.  Use the map to get the
	new names for the renaming of induction variables and for the
	renaming of variables after a basic block has been copied.
	(expand_scalar_variables): Same.
	(graphite_rename_variables): Renamed rename_variables.
	(move_phi_nodes): Removed.
	(get_false_edge_from_guard_bb): New.
	(build_iv_mapping): Do not insert the induction variable of a
	loop in the renaming iv map if the basic block does not belong
	to that loop.
	(register_old_new_names, graphite_copy_stmts_from_block,
	copy_bb_and_scalar_dependences): New.
	(translate_clast): Heavily reimplemented: copy basic blocks,
	do not move them.  Finally, in call cleanup_tree_cfg in gloog.
	At each translation step call graphite_verify ensuring the 
	consistency of the SSA, loops and dominators information.
	(collect_virtual_phis, find_vdef_for_var_in_bb,
	find_vdef_for_var_1, find_vdef_for_var,
	patch_phis_for_virtual_defs): Removed huge hack.
	(mark_old_loops, remove_dead_loops, skip_phi_defs,
	collect_scop_exit_phi_args, patch_scop_exit_phi_args,
	gbb_can_be_ignored, scop_remove_ignoreable_gbbs, ): Removed.
	(remove_sese_region, ifsese, if_region_entry, if_region_exit,
	if_region_get_condition_block, if_region_set_false_region,
	create_if_region_on_edge, move_sese_in_condition, bb_in_sese_p,
	sese_find_uses_to_rename_use, sese_find_uses_to_rename_bb, 
	sese_add_exit_phis_edge, sese_add_exit_phis_var,
	rewrite_into_sese_closed_ssa): New.
	(gloog): Remove dead code.  Early return if code cannot be
	generated.  Call cleanup_tree_cfg once the scop has been code
	generated.
	(graphite_trans_scop_block, graphite_trans_loop_block): Do not 
	block loops with less than two loops.
	(graphite_apply_transformations): Remove the call to
	scop_remove_ignoreable_gbbs.
	(limit_scops): When build_scop_loop_nests fails, continue on next scop.
	Fix open_scop.entry.
	(graphite_transform_loops): Call recompute_all_dominators: force the
	recomputation of correct CDI_DOMINATORS and CDI_POST_DOMINATORS.
	Call initialize_original_copy_tables and free_original_copy_tables
	to be able to copy basic blocks during code generation.
	When build_scop_loop_nests fails, continue on next scop.
	(value_clast): New union.
	(clast_to_gcc_expression): Fix type cast warning.

2008-12-11  Sebastian Pop  <sebastian.pop@amd.com>

	* gcc.dg/graphite/pr37928.c: New.
	* gcc.dg/graphite/pr37883.c: New.
	* gcc.dg/graphite/pr38073.c: New.
	* gcc.dg/graphite/pr38125.c: New.
	* gfortran.dg/graphite/pr38083.f90: New.
	* gfortran.dg/graphite/pr37852.f90: New.
	* gfortran.dg/graphite/pr37980.f90: New.
	* gfortran.dg/graphite/id-2.f90: New.
	* gfortran.dg/graphite/id-4.f90: New.

	* gcc.dg/graphite/scop-18.c: Remove reduction, test for
	the number of detected scops.  Copy exact same test for loop blocking...
	* gcc.dg/graphite/block-1.c: Fix the number of expected loops
	to be blocked as reductions are not handled.
	* gcc.dg/graphite/block-4.c: ...here.  New.

From-SVN: r142673
parent 564a6431
2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
Fix testsuite/gfortran.dg/graphite/id-4.f90.
* graphite.c (scan_tree_for_params): Do not compute the multiplicand
when not needed.
2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
* graphite.c (build_scops_1): Initialize open_scop.exit
and sinfo.last.
2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
Jan Sjodin <jan.sjodin@amd.com>
Harsha Jagasia <harsha.jagasia@amd.com>
PR middle-end/37852
PR middle-end/37883
PR middle-end/37928
PR middle-end/37980
PR middle-end/38038
PR middle-end/38039
PR middle-end/38073
PR middle-end/38083
PR middle-end/38125
* tree-phinodes.c (remove_phi_nodes): New, extracted from...
* tree-cfg.c (remove_phi_nodes_and_edges_for_unreachable_block): ...here.
* tree-flow.h (remove_phi_nodes, canonicalize_loop_ivs): Declared.
* Makefile.in (graphite.o): Depend on value-prof.h.
(graphite.o-warn): Removed -Wno-error.
* tree-parloops.c (canonicalize_loop_ivs): Allow reduction_list
to be a NULL pointer. Call update_stmt. Return the newly created
cannonical induction variable.
* graphite.h (debug_rename_map): Declared. Fix some comments.
* graphite.c: Reimplement the code generation from graphite to gimple.
Include value-prof.h.
(loop_iv_stack_get_iv): Do not return NULL for constant substitutions.
(get_old_iv_from_ssa_name): Removed.
(graphite_stmt_p): New.
(new_graphite_bb): Test for useful statements before building a
graphite statement for the basic block.
(free_graphite_bb): Do not free GBB_DATA_REFS: this is a bug
in free_data_ref that calls BITMAP_FREE (DR_VOPS (dr)) without
reason.
(recompute_all_dominators, graphite_verify,
nb_reductions_in_loop, graphite_loop_normal_form): New.
(scop_record_loop): Call graphite_loop_normal_form.
(build_scop_loop_nests): Iterate over all the blocks of the
function instead of relying on the incomplete information from
SCOP_BBS. Return the success of the operation.
(find_params_in_bb): Use the data from GBB_DATA_REFS.
(add_bb_domains): Removed.
(build_loop_iteration_domains): Don't call add_bb_domains.
Add the iteration domain only to the basic blocks that have been
translated to graphite.
(build_scop_conditions_1): Add constraints only if the basic
block have been translated to graphite.
(build_scop_data_accesses): Completely disabled until data
dependence is correctly implemented.
(debug_rename_elt, debug_rename_map_1, debug_rename_map): New.
(remove_all_edges_1, remove_all_edges): Removed.
(get_new_name_from_old_name): New.
(graphite_rename_variables_in_stmt): Renamed
rename_variables_in_stmt. Call get_new_name_from_old_name.
Use replace_exp and update_stmt.
(is_old_iv): Renamed is_iv.
(expand_scalar_variables_stmt): Extra parameter for renaming map.
Use replace_exp and update_stmt.
(expand_scalar_variables_expr): Same. Use the map to get the
new names for the renaming of induction variables and for the
renaming of variables after a basic block has been copied.
(expand_scalar_variables): Same.
(graphite_rename_variables): Renamed rename_variables.
(move_phi_nodes): Removed.
(get_false_edge_from_guard_bb): New.
(build_iv_mapping): Do not insert the induction variable of a
loop in the renaming iv map if the basic block does not belong
to that loop.
(register_old_new_names, graphite_copy_stmts_from_block,
copy_bb_and_scalar_dependences): New.
(translate_clast): Heavily reimplemented: copy basic blocks,
do not move them. Finally, in call cleanup_tree_cfg in gloog.
At each translation step call graphite_verify ensuring the
consistency of the SSA, loops and dominators information.
(collect_virtual_phis, find_vdef_for_var_in_bb,
find_vdef_for_var_1, find_vdef_for_var,
patch_phis_for_virtual_defs): Removed huge hack.
(mark_old_loops, remove_dead_loops, skip_phi_defs,
collect_scop_exit_phi_args, patch_scop_exit_phi_args,
gbb_can_be_ignored, scop_remove_ignoreable_gbbs, ): Removed.
(remove_sese_region, ifsese, if_region_entry, if_region_exit,
if_region_get_condition_block, if_region_set_false_region,
create_if_region_on_edge, move_sese_in_condition, bb_in_sese_p,
sese_find_uses_to_rename_use, sese_find_uses_to_rename_bb,
sese_add_exit_phis_edge, sese_add_exit_phis_var,
rewrite_into_sese_closed_ssa): New.
(gloog): Remove dead code. Early return if code cannot be
generated. Call cleanup_tree_cfg once the scop has been code
generated.
(graphite_trans_scop_block, graphite_trans_loop_block): Do not
block loops with less than two loops.
(graphite_apply_transformations): Remove the call to
scop_remove_ignoreable_gbbs.
(limit_scops): When build_scop_loop_nests fails, continue on next scop.
Fix open_scop.entry.
(graphite_transform_loops): Call recompute_all_dominators: force the
recomputation of correct CDI_DOMINATORS and CDI_POST_DOMINATORS.
Call initialize_original_copy_tables and free_original_copy_tables
to be able to copy basic blocks during code generation.
When build_scop_loop_nests fails, continue on next scop.
(value_clast): New union.
(clast_to_gcc_expression): Fix type cast warning.
2008-12-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36792
......@@ -261,8 +376,6 @@
Fix testsuite/gfortran.dg/graphite/id-3.f90.
* graphite.c (scopdet_basic_block_info): Fix bug that found some
regions more than once.
* testsuite/gfortran.dg/graphite/id-3.f90: New.
* gcc/testsuite/gcc.dg/graphite/pr38084.c: New.
2008-12-09 Ben Elliston <bje@au.ibm.com>
......@@ -183,8 +183,6 @@ dfp.o-warn = -Wno-error
bitmap.o-warn = -Wno-error
# dominance.c contains a -Wc++compat warning.
dominance.o-warn = -Wno-error
# graphite.c contains code calling cloog that has problems.
graphite.o-warn = -Wno-error
# mips-tfile.c contains -Wcast-qual warnings.
mips-tfile.o-warn = -Wno-error
......@@ -2368,7 +2366,8 @@ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
graphite.o: graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) domwalk.h \
$(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h graphite.h pointer-set.h
$(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h graphite.h pointer-set.h \
value-prof.h
tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RECOG_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
......
......@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GRAPHITE_H
#define GCC_GRAPHITE_H
#include "tree-data-ref.h"
typedef struct graphite_bb *graphite_bb_p;
......@@ -31,7 +34,7 @@ static inline int scop_nb_loops (scop_p scop);
static inline unsigned scop_nb_params (scop_p scop);
static inline bool scop_contains_loop (scop_p scop, struct loop *loop);
struct graphite_bb
typedef struct graphite_bb
{
basic_block bb;
scop_p scop;
......@@ -129,9 +132,9 @@ struct graphite_bb
B
}
So for B there is a additional condition (2i <= 8).
So for B there is an additional condition (2i <= 8).
TODO: Add this restrictions to the domain matrix.
TODO: Add these restrictions to the domain matrix.
List of COND_EXPR and SWITCH_EXPR. A COND_EXPR is true only if the
corresponding element in CONDITION_CASES is not NULL_TREE. For a
......@@ -190,7 +193,7 @@ struct graphite_bb
lambda_vector compressed_alpha_matrix;
CloogMatrix *dynamic_schedule;
VEC (data_reference_p, heap) *data_refs;
};
} *gbb_p;
#define GBB_BB(GBB) GBB->bb
#define GBB_SCOP(GBB) GBB->scop
......@@ -234,7 +237,7 @@ gbb_loop_at_index (graphite_bb_p gb, int index)
return VEC_index (loop_p, GBB_LOOPS (gb), index);
}
/* Returns the corresponding loop iterator index for a gimple loop. */
/* Returns the index of LOOP in the loop nest around GB. */
static inline int
gbb_loop_index (graphite_bb_p gb, loop_p loop)
......@@ -305,8 +308,13 @@ struct scop
/* ??? It looks like a global mapping loop_id -> cloog_loop would work. */
htab_t loop2cloog_loop;
/* CLooG representation of this SCOP. */
/* Cloog representation of this scop. */
CloogProgram *program;
/* Are we allowed to add more params? This is for debugging purpose. We
can only add new params before generating the bb domains, otherwise they
become invalid. */
bool add_params;
};
#define SCOP_BBS(S) S->bbs
......@@ -322,6 +330,7 @@ struct scop
#define SCOP_STATIC_SCHEDULE(S) S->static_schedule
#define SCOP_LOOPS(S) S->loops
#define SCOP_LOOP_NEST(S) S->loop_nest
#define SCOP_ADD_PARAMS(S) S->add_params
#define SCOP_PARAMS(S) S->params
#define SCOP_OLDIVS(S) S->old_ivs
#define SCOP_PROG(S) S->program
......@@ -335,8 +344,7 @@ extern void debug_gbb (graphite_bb_p, int);
extern void dot_scop (scop_p);
extern void dot_all_scops (void);
extern void debug_clast_stmt (struct clast_stmt *);
extern void debug_rename_map (htab_t);
extern void debug_loop_vec (graphite_bb_p gb);
extern void debug_oldivs (scop_p);
......@@ -369,7 +377,6 @@ DEF_VEC_ALLOC_P(iv_stack_entry_p,heap);
typedef VEC(iv_stack_entry_p, heap) **loop_iv_stack;
extern void debug_loop_iv_stack (loop_iv_stack);
/* Return the number of gimple loops contained in SCOP. */
static inline int
......@@ -422,15 +429,6 @@ loop_domain_dim (unsigned int loop_num, scop_p scop)
return cloog_domain_dim (cloog_loop_domain (slot->cloog_loop)) + 2;
}
/* Returns the dimensionality of an enclosing loop iteration domain
with respect to enclosing SCoP for a given data reference REF. */
static inline int
ref_nb_loops (data_reference_p ref)
{
return loop_domain_dim (loop_containing_stmt (DR_STMT (ref))->num, DR_SCOP (ref));
}
/* Returns the dimensionality of a loop iteration vector in a loop
iteration domain for a given loop (identified by LOOP_NUM) with
respect to SCOP. */
......@@ -521,22 +519,59 @@ scop_gimple_loop_depth (scop_p scop, loop_p loop)
return depth;
}
/* Associate a POLYHEDRON dependence description to two data
references A and B. */
struct data_dependence_polyhedron
/* Static inline function prototypes. */
static inline unsigned scop_nb_params (scop_p scop);
/* Returns true when BB is in SCOP. */
static inline bool
bb_in_scop_p (basic_block bb, scop_p scop)
{
struct data_reference *a;
struct data_reference *b;
bool reversed_p;
bool loop_carried; /*TODO:konrad get rid of this, make level signed */
signed level;
CloogDomain *polyhedron;
};
return bitmap_bit_p (SCOP_BBS_B (scop), bb->index);
}
/* Returns true when LOOP is in SCOP. */
#define RDGE_DDP(E) ((struct data_dependence_polyhedron*) ((E)->data))
static inline bool
loop_in_scop_p (struct loop *loop, scop_p scop)
{
return (bb_in_scop_p (loop->header, scop)
&& bb_in_scop_p (loop->latch, scop));
}
typedef struct data_dependence_polyhedron *ddp_p;
/* Calculate the number of loops around LOOP in the SCOP. */
static inline int
nb_loops_around_loop_in_scop (struct loop *l, scop_p scop)
{
int d = 0;
DEF_VEC_P(ddp_p);
DEF_VEC_ALLOC_P(ddp_p,heap);
for (; loop_in_scop_p (l, scop); d++, l = loop_outer (l));
return d;
}
/* Calculate the number of loops around GB in the current SCOP. */
static inline int
nb_loops_around_gb (graphite_bb_p gb)
{
return nb_loops_around_loop_in_scop (gbb_loop (gb), GBB_SCOP (gb));
}
/* Returns the dimensionality of an enclosing loop iteration domain
with respect to enclosing SCoP for a given data reference REF. The
returned dimensionality is homogeneous (depth of loop nest + number
of SCoP parameters + const). */
static inline int
ref_nb_loops (data_reference_p ref)
{
loop_p loop = loop_containing_stmt (DR_STMT (ref));
scop_p scop = DR_SCOP (ref);
return nb_loops_around_loop_in_scop (loop, scop) + scop_nb_params (scop) + 2;
}
#endif /* GCC_GRAPHITE_H */
2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/37852
PR middle-end/37883
PR middle-end/37928
PR middle-end/37980
PR middle-end/38038
PR middle-end/38039
PR middle-end/38073
PR middle-end/38083
PR middle-end/38125
* gcc.dg/graphite/pr37928.c: New.
* gcc.dg/graphite/pr37883.c: New.
* gcc.dg/graphite/pr38073.c: New.
* gcc.dg/graphite/pr38125.c: New.
* gfortran.dg/graphite/pr38083.f90: New.
* gfortran.dg/graphite/pr37852.f90: New.
* gfortran.dg/graphite/pr37980.f90: New.
* gfortran.dg/graphite/id-2.f90: New.
* gfortran.dg/graphite/id-4.f90: New.
* gcc.dg/graphite/scop-18.c: Remove reduction, test for
the number of detected scops. Copy exact same test for loop blocking...
* gcc.dg/graphite/block-1.c: Fix the number of expected loops
to be blocked as reductions are not handled.
* gcc.dg/graphite/block-4.c: ...here. New.
2008-12-11 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/38464
......@@ -95,6 +122,12 @@
PR c++/38410
* gcc.dg/ctor1.c: New test.
2008-12-09 Tobias Grosser <grosser@fim.uni-passau.de>
PR middle-end/38084
* gfortran.dg/graphite/id-3.f90: New.
* gcc.dg/graphite/pr38084.c: New.
2008-12-08 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/mips/fix-r10000-6.c: Add dg-message to look for
......
......@@ -2,6 +2,8 @@
#define MAX 8192
void bar (void);
int main()
{
int i, j;
......@@ -9,6 +11,8 @@ int main()
int A[MAX * MAX];
int B[MAX * MAX];
bar ();
for (i = 0; i < MAX; i++)
for (j = 0; j < MAX; j++)
{
......@@ -20,6 +24,11 @@ int main()
for (j = 0; j < MAX; j++)
A[i*MAX + j] += B[j*MAX + i];
bar ();
/* FIXME: For now, reductions are not handled by the code generation
of graphite. We have to bound the scop to the above loops. */
for(i = 0; i < MAX; i++)
for(j = 0; j < MAX; j++)
sum += A[i*MAX + j];
......@@ -27,5 +36,5 @@ int main()
return sum;
}
/* { dg-final { scan-tree-dump-times "Loop blocked" 3 "graphite"} } */
/* { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
#define N 24
#define M 1000
float A[1000][1000], B[1000][1000], C[1000][1000];
void test (void)
{
int i, j, k;
/* These loops contain too few iterations for being strip-mined by 64. */
for (i = 0; i < 24; i++)
for (j = 0; j < 24; j++)
for (k = 0; k < 24; k++)
A[i][j] = B[i][k] * C[k][j];
/* These loops should still be strip mined. */
for (i = 0; i < 1000; i++)
for (j = 0; j < 1000; j++)
for (k = 0; k < 1000; k++)
A[i][j] = B[i][k] * C[k][j];
}
/* { dg-final { scan-tree-dump-times "Strip Mining is not profitable" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O3 -floop-block" } */
void test_sort()
{
char *base;
register char c, *i, *hi;
for (i = base; i < hi; i++)
*i++ = c;
}
/* { dg-options "-O3 -floop-block" } */
int get_state(int size, int *node, int *hash)
{
int i=0;
while(hash[i])
{
if(node[hash[i]] == 0)
return hash[i]-1;
i++;
if(i==5)
i=0;
}
return -1;
}
void foo (int);
int gate1(int size, int *node, int *hash)
{
int i, j ;
int add_size=0;
for(i=0; i<size; i++)
{
j = get_state(size,node, hash);
if(j == -1)
{
add_size++;
}
}
foo (size+add_size);
}
/* { dg-options "-O3 -fgraphite-identity" } */
test_seg(int a, int b)
{
int i,r=1;
for(i=0; i<b ;i++)
r*=a;
return r;
}
/* { dg-options "-O3 -fgraphite-identity" } */
typedef struct sv TEST_SV;
typedef struct av TEST_AV;
typedef struct magic TEST_MAGIC;
typedef struct xpvav TEST_XPVAV;
struct sv
{
void* sv_any;
};
struct av
{
TEST_XPVAV* sv_any;
};
struct xpvav
{
char* xav_array;
long int xav_fill;
long int xav_max;
};
struct magic {
TEST_SV* mg_obj;
};
extern TEST_SV PL_sv_undef;
Perl_av_fill( register TEST_AV *av, int fill)
{
TEST_MAGIC *mg;
int key = ((TEST_XPVAV*) (av)->sv_any)->xav_fill;
TEST_SV** ary = ((TEST_SV**)((TEST_XPVAV*) (av)->sv_any)->xav_array);
while (key < fill)
ary[++key] = &PL_sv_undef;
}
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
#define N 24
#define M 1000
......@@ -13,14 +13,14 @@ void test (void)
for (i = 0; i < 24; i++)
for (j = 0; j < 24; j++)
for (k = 0; k < 24; k++)
A[i][j] += B[i][k] * C[k][j];
A[i][j] = B[i][k] * C[k][j];
/* These loops should still be strip mined. */
for (i = 0; i < 1000; i++)
for (j = 0; j < 1000; j++)
for (k = 0; k < 1000; k++)
A[i][j] += B[i][k] * C[k][j];
A[i][j] = B[i][k] * C[k][j];
}
/* { dg-final { scan-tree-dump-times "Strip Mining is not profitable" 3 "graphite" } } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
! { dg-options "-O2 -fgraphite-identity" }
module solv_cap
integer, parameter, public :: dp = selected_real_kind(5)
contains
subroutine prod0( G, X )
real(kind=dp), intent(in out), dimension(:,:) :: X
real(kind=dp), dimension(size(X,1),size(X,2)) :: Y
X = Y
end subroutine prod0
function Ginteg(xq1,yq1, xq2,yq2, xp,yp) result(G)
end function Ginteg
subroutine fourir(A,ntot,kconjg, E,useold)
end subroutine fourir
end module solv_cap
! { dg-options "-O2 -fgraphite-identity" }
MODULE Vcimage
CHARACTER (LEN=80), SAVE :: CARD, FIELD
END MODULE Vcimage
MODULE Vimage
LOGICAL, SAVE :: EOFF
END MODULE Vimage
SUBROUTINE READIN(PROB, TITLE, CSTOP, FCYCLE, DCYCLE, DHIST, VHIST&
& , IMAX, PHIST, DEBUG, NSTAT, STATS, MAXSTA, NCORE, PPLOT, &
& DPLOT, VPLOT, TPLOT, SLIST, D0, E0, NODES, SHEAT, GAMMA, COLD &
& , THIST, NVISC, SCREEN, WEIGHT, TSTOP, STABF)
USE Vcimage
USE Vimage
INTEGER, DIMENSION(MAXSTA) :: STATS
IF (.NOT.EOFF) THEN
IF (FIELD=='PROB' .OR. FIELD=='PROBLEM_NUMBER') THEN
CALL QSORT (STATS(1:NSTAT))
WRITE (16, &
&'(//'' YOU HAVE REQUESTED A PRINTOUT OF THE STATION'', &
& '' ABORT''//)')
ENDIF
ENDIF
CONTAINS
RECURSIVE SUBROUTINE QSORT (LIST)
INTEGER, DIMENSION(:), INTENT(INOUT) :: LIST
INTEGER, DIMENSION(SIZE(LIST)) :: SMALLER,LARGER
IF (SIZE(LIST) > 1) THEN
LIST(NUMBER_SMALLER+1:NUMBER_SMALLER+NUMBER_EQUAL) = CHOSEN
CALL QSORT (LARGER(1:NUMBER_LARGER))
LIST(NUMBER_SMALLER+NUMBER_EQUAL+1:) = LARGER(1:NUMBER_LARGER)
END IF
END SUBROUTINE QSORT
END SUBROUTINE READIN
! { dg-options "-O2 -floop-block" }
PROGRAM TEST_FPU
CHARACTER (LEN=36) :: invert_id(1) = &
(/ 'Test1 - Gauss 2000 (101x101) inverts'/)
END PROGRAM TEST_FPU
SUBROUTINE Gauss (a,n)
INTEGER, PARAMETER :: RK8 = SELECTED_REAL_KIND(15, 300)
REAL(RK8) :: a(n,n)
INTEGER :: ipvt(n)
a(:,ipvt) = b
END SUBROUTINE Gauss
! { dg-options "-O2 -floop-block" }
module INT_MODULE
contains
pure function spher_cartesians(in1) result(out1)
integer(kind=kind(1)) :: in1
intent(in) :: in1
real(kind=kind(1.0d0)), dimension(0:in1,0:in1,0:in1) :: mat0
mat0 = 0.0d0
end function spher_cartesians
end module INT_MODULE
! { dg-options "-O3 -floop-block" }
SUBROUTINE IVSORT (IL,IH,NSEGS,IOUNIT)
INTEGER IOUNIT
INTEGER, PARAMETER :: MAXGS = 32
10 IF (IL .GE. IH) GO TO 80
20 NSEGS = (IH + IL) / 2
IF (NSEGS .GT. MAXSGS) THEN
WRITE (IOUNIT),MAXSGS
ENDIF
80 NSEGS = NSEGS - 1
90 IF (IH - IL .GE. 11) GO TO 20
110 IF (IL .EQ. IH) GO TO 80
END SUBROUTINE IVSORT
......@@ -2072,14 +2072,9 @@ struct gimple_opt_pass pass_remove_useless_stmts =
static void
remove_phi_nodes_and_edges_for_unreachable_block (basic_block bb)
{
gimple_stmt_iterator gsi;
/* Since this block is no longer reachable, we can just delete all
of its PHI nodes. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
remove_phi_node (&gsi, true);
set_phi_nodes (bb, NULL);
remove_phi_nodes (bb);
/* Remove edges to BB's successors. */
while (EDGE_COUNT (bb->succs) > 0)
......
......@@ -787,6 +787,7 @@ extern gimple create_phi_node (tree, basic_block);
extern void add_phi_arg (gimple, tree, edge);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
extern void init_phinodes (void);
extern void fini_phinodes (void);
extern void release_phi_node (gimple);
......@@ -988,6 +989,7 @@ unsigned int tree_ssa_prefetch_arrays (void);
unsigned int remove_empty_loops (void);
void tree_ssa_iv_optimize (void);
unsigned tree_predictive_commoning (void);
tree canonicalize_loop_ivs (struct loop *, htab_t, tree);
bool parallelize_loops (void);
bool loop_only_exit_p (const struct loop *, const_edge);
......
......@@ -1325,9 +1325,10 @@ create_loop_fn (void)
/* Bases all the induction variables in LOOP on a single induction variable
(unsigned with base 0 and step 1), whose final value is compared with
NIT. The induction variable is incremented in the loop latch.
REDUCTION_LIST describes the reductions in LOOP. */
REDUCTION_LIST describes the reductions in LOOP. Return the induction
variable that was created. */
static void
tree
canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
{
unsigned precision = TYPE_PRECISION (TREE_TYPE (nit));
......@@ -1368,7 +1369,12 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
}
ok = simple_iv (loop, phi, res, &iv, true);
if (reduction_list)
red = reduction_phi (reduction_list, phi);
else
red = NULL;
/* We preserve the reduction phi nodes. */
if (!ok && red)
{
......@@ -1406,6 +1412,9 @@ canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree nit)
gimple_cond_set_code (stmt, LT_EXPR);
gimple_cond_set_lhs (stmt, var_before);
gimple_cond_set_rhs (stmt, nit);
update_stmt (stmt);
return var_before;
}
/* Moves the exit condition of LOOP to the beginning of its header, and
......
......@@ -474,4 +474,17 @@ remove_phi_node (gimple_stmt_iterator *gsi, bool release_lhs_p)
release_ssa_name (gimple_phi_result (phi));
}
/* Remove all the phi nodes from BB. */
void
remove_phi_nodes (basic_block bb)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
remove_phi_node (&gsi, true);
set_phi_nodes (bb, NULL);
}
#include "gt-tree-phinodes.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment