From e0ca0e9de1a14d0a4fed652796bdce10bc7f4538 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Tue, 15 Jun 2010 11:08:57 -0500
Subject: [PATCH] Fix PR44391: use size_one_node for pointer types.
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.
---
gcc/graphite-clast-to-gimple.c | 17 +++++------------
gcc/testsuite/gcc.dg/graphite/pr44391.c | 7 +++++++
2 files changed, 12 insertions(+), 12 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/graphite/pr44391.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))
new file mode 100644
@@ -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;
+}
--
1.7.0.4