summaryrefslogtreecommitdiff
path: root/gcc/graphite-clast-to-gimple.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-15 19:11:59 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-15 19:11:59 +0000
commitc5c862592eb0c39c5981043aed06ce4552e4ecc3 (patch)
tree1c826e17388a4fe39e11ce72d6aa5f01156f43f2 /gcc/graphite-clast-to-gimple.c
parentde6229046ca7a9d04c27f1d5427258d272f8bdbf (diff)
downloadgcc-c5c862592eb0c39c5981043aed06ce4552e4ecc3.tar.gz
Fix PR44391: use size_one_node for pointer types.
2010-06-15 Sebastian Pop <sebastian.pop@amd.com> 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160803 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-clast-to-gimple.c')
-rw-r--r--gcc/graphite-clast-to-gimple.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 8116afed1a4..b6b8d3134b1 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))