From 3e8f8cfd0c4298b6b5e88c8bc7ba81a01e7cd815 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Sun, 24 Jul 2011 01:52:52 -0500
Subject: [PATCH] Fix PR49471: canonicalize_loop_ivs should not generate unsigned types.
2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/49471
* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned
iv only when the largest type is unsigned. Do not call
lang_hooks.types.type_for_size.
* testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail.
* testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern.
---
gcc/ChangeLog | 7 +++++++
gcc/tree-ssa-loop-manip.c | 19 ++++++++++++++++---
libgomp/ChangeLog | 5 +++++
.../testsuite/libgomp.graphite/force-parallel-1.c | 2 +-
.../testsuite/libgomp.graphite/force-parallel-2.c | 2 +-
5 files changed, 30 insertions(+), 5 deletions(-)
@@ -1,5 +1,12 @@
2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
+ PR tree-optimization/49471
+ * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned
+ iv only when the largest type is unsigned. Do not call
+ lang_hooks.types.type_for_size.
+
+2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/47691
* graphite-clast-to-gimple.c (translate_clast_user): Update use of
copy_bb_and_scalar_dependences.
@@ -1200,18 +1200,31 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
gimple stmt;
edge exit = single_dom_exit (loop);
gimple_seq stmts;
+ enum machine_mode mode;
+ bool unsigned_p = false;
for (psi = gsi_start_phis (loop->header);
!gsi_end_p (psi); gsi_next (&psi))
{
gimple phi = gsi_stmt (psi);
tree res = PHI_RESULT (phi);
+ bool uns;
- if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
- precision = TYPE_PRECISION (TREE_TYPE (res));
+ type = TREE_TYPE (res);
+ if (!is_gimple_reg (res)
+ || (!INTEGRAL_TYPE_P (type)
+ && !POINTER_TYPE_P (type))
+ || TYPE_PRECISION (type) < precision)
+ continue;
+
+ uns = POINTER_TYPE_P (type) | TYPE_UNSIGNED (type);
+ unsigned_p = TYPE_PRECISION (type) > precision ? uns : unsigned_p | uns;
+ precision = TYPE_PRECISION (type);
}
- type = lang_hooks.types.type_for_size (precision, 1);
+ mode = smallest_mode_for_size (precision, MODE_INT);
+ precision = GET_MODE_PRECISION (mode);
+ type = build_nonstandard_integer_type (precision, unsigned_p);
if (original_precision != precision)
{
@@ -1,3 +1,8 @@
+2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail.
+ * testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern.
+
2011-07-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/49541
@@ -23,7 +23,7 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
-/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */
@@ -23,7 +23,7 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
-/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */
--
1.7.4.1