From 6ab4e30772ed8513b2ae951524a554d2f05fcc15 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Tue, 15 Jun 2010 19:11:59 +0000 Subject: [PATCH] Fix PR44391: use size_one_node for pointer types. 2010-06-15 Sebastian Pop PR middle-end/44391 * graphite-clast-to-gimple.c (graphite_create_new_loop_guard): Use size_one_node for pointer types. Do not call gmp_cst_to_tree. * gcc.dg/graphite/pr44391.c: New. From-SVN: r160803 --- gcc/ChangeLog | 10 ++++++++-- gcc/graphite-clast-to-gimple.c | 17 +++++------------ gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/gcc.dg/graphite/pr44391.c | 7 +++++++ 4 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr44391.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 960f2fa..440d145 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,15 @@ +2010-06-15 Sebastian Pop + + PR middle-end/44391 + * graphite-clast-to-gimple.c (graphite_create_new_loop_guard): Use + size_one_node for pointer types. Do not call gmp_cst_to_tree. + 2010-06-15 Richard Guenther * tree-ssa-pre.c (eliminate): Handle PHI elimination to constants. 2010-06-15 Paul Brook - + * config/arm/arm.c (use_vfp_abi): Add sorry() for Thumb-1 hard-float ABI. @@ -196,7 +202,7 @@ 2010-06-14 Ira Rosen - PR tree-optimization/44507 + PR tree-optimization/44507 * tree-vect-loop.c (get_initial_def_for_reduction): Use -1 to build initial vector for BIT_AND_EXPR. * tree-vect-slp.c (vect_get_constant_vectors): Likewise. diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 8116afe..b6b8d31 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -991,6 +991,7 @@ translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e, /* Creates a new if region protecting the loop to be executed, if the execution count is zero (lb > ub). */ + static edge graphite_create_new_loop_guard (sese region, edge entry_edge, struct clast_for *stmt, @@ -1008,22 +1009,14 @@ graphite_create_new_loop_guard (sese region, edge entry_edge, newivs_index, params_index); tree ub = clast_to_gcc_expression (type, stmt->UB, region, newivs, newivs_index, params_index); - tree ub_one; - + tree one = POINTER_TYPE_P (type) ? size_one_node + : fold_convert (type, integer_one_node); /* Adding +1 and using LT_EXPR helps with loop latches that have a loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes 2^{32|64}, and the condition lb <= ub is true, even if we do not want this. However lb < ub + 1 is false, as expected. */ - tree one; - mpz_t gmp_one; - - mpz_init (gmp_one); - mpz_set_si (gmp_one, 1); - one = gmp_cst_to_tree (type, gmp_one); - mpz_clear (gmp_one); - - ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR, - type, ub, one); + tree ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR + : PLUS_EXPR, type, ub, one); /* When ub + 1 wraps around, use lb <= ub. */ if (integer_zerop (ub_one)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 69dd222..60d29a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-15 Sebastian Pop + + PR middle-end/44391 + * gcc.dg/graphite/pr44391.c: New. + 2010-06-15 Janus Weil PR fortran/43388 @@ -49,7 +54,7 @@ 2010-06-14 Ira Rosen - PR tree-optimization/44507 + PR tree-optimization/44507 * gcc.dg/vect/pr44507.c: New test. 2010-06-13 H.J. Lu diff --git a/gcc/testsuite/gcc.dg/graphite/pr44391.c b/gcc/testsuite/gcc.dg/graphite/pr44391.c new file mode 100644 index 0000000..91b3afa --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr44391.c @@ -0,0 +1,7 @@ +/* { dg-options "-Os -m32 -fgraphite-identity -ffast-math" } */ + +void byte_insert_op1 (unsigned char *loc, unsigned char *end, unsigned *pto) +{ + while (end != loc) + *pto = *--end; +} -- 2.7.4