Commit 69f2880c by Jan Sjodin Committed by Sebastian Pop

lambda.h (build_linear_expr): New.

	* lambda.h (build_linear_expr): New.
	* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression): 
	Use build_linear_expr, call fold and force_gimple_operand.
	(lambda_loopnest_to_gcc_loopnest): Check that there is
	something to insert.
	* testsuite/gcc.dg/tree-ssa/ltrans-6.c: New.


Co-Authored-By: Sebastian Pop <sebpop@gmail.com>

From-SVN: r125355
parent 518a0b78
2007-06-06 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebpop@gmail.com>
* lambda.h (build_linear_expr): New.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression):
Use build_linear_expr, call fold and force_gimple_operand.
(lambda_loopnest_to_gcc_loopnest): Check that there is
something to insert.
* testsuite/gcc.dg/tree-ssa/ltrans-6.c: New.
2007-06-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
PR preprocessor/23479
......
......@@ -434,5 +434,32 @@ lambda_vector_lexico_pos (lambda_vector v,
return true;
}
/* Given a vector of induction variables IVS, and a vector of
coefficients COEFS, build a tree that is a linear combination of
the induction variables. */
static inline tree
build_linear_expr (tree type, lambda_vector coefs, VEC (tree, heap) *ivs)
{
unsigned i;
tree iv;
tree expr = fold_convert (type, integer_zero_node);
for (i = 0; VEC_iterate (tree, ivs, i, iv); i++)
{
int k = coefs[i];
if (k == 1)
expr = fold_build2 (PLUS_EXPR, type, expr, iv);
else if (k != 0)
expr = fold_build2 (PLUS_EXPR, type, expr,
fold_build2 (MULT_EXPR, type, iv,
build_int_cst (type, k)));
}
return expr;
}
#endif /* LAMBDA_H */
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
/* { dg-require-effective-target size32plus } */
int medium_loop_interchange(int A[100][200])
{
int i,j;
/* This loop should be interchanged. */
for(j = 0; j < 200; j++)
for(i = 0; i < 100; i++)
A[i][j] = A[i][j] + A[i][j];
return A[1][1];
}
/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */
/* { dg-final { cleanup-tree-dump "ltrans" } } */
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