tree-optimization/93964 - adjust ISL code generation for pointer params
authorRichard Biener <rguenther@suse.de>
Wed, 4 Mar 2020 09:40:32 +0000 (10:40 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 4 Mar 2020 10:37:27 +0000 (11:37 +0100)
Pointers eventually need intermediate conversions in code generation.
Allowing them is much easier than fending them off since niter
and scev expansion easily drag those in.

2020-02-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/93964
* graphite-isl-ast-to-gimple.c
(gcc_expression_from_isl_ast_expr_id): Add intermediate
conversion for pointer to integer converts.
* graphite-scop-detection.c (assign_parameter_index_in_region):
Relax assert.

* gcc.dg/graphite/pr93964.c: New testcase.

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/graphite-scop-detection.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr93964.c [new file with mode: 0644]

index a08bdaf8ecd0e7ae30fd5f82b6ddcd5b7a64c2a5..82b66089c8a70c1427a2b208d210e5fd8c53a6f0 100644 (file)
@@ -1,3 +1,12 @@
+2020-02-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/93964
+       * graphite-isl-ast-to-gimple.c
+       (gcc_expression_from_isl_ast_expr_id): Add intermediate
+       conversion for pointer to integer converts.
+       * graphite-scop-detection.c (assign_parameter_index_in_region):
+       Relax assert.
+
 2020-03-04  Martin Liska  <mliska@suse.cz>
 
        PR c/93886
index c08a259a80e1cf7c4fa3d7754f501b8b2e7e722e..ef93fda2233576f90419bf1a3415e94f8f77cd12 100644 (file)
@@ -265,6 +265,9 @@ gcc_expression_from_isl_ast_expr_id (tree type,
   tree t = res->second;
   if (useless_type_conversion_p (type, TREE_TYPE (t)))
     return t;
+  if (POINTER_TYPE_P (TREE_TYPE (t))
+      && !POINTER_TYPE_P (type) && !ptrofftype_p (type))
+    t = fold_convert (sizetype, t);
   return fold_convert (type, t);
 }
 
index ed12fea801b5b0089988d55f82b9801e3efef026..75f81227f8a0f88e17dbfb014b076a7411bde3a4 100644 (file)
@@ -1102,7 +1102,6 @@ static void
 assign_parameter_index_in_region (tree name, sese_info_p region)
 {
   gcc_assert (TREE_CODE (name) == SSA_NAME
-             && INTEGRAL_TYPE_P (TREE_TYPE (name))
              && ! defined_in_sese_p (name, region->region));
   int i;
   tree p;
index a13a0a4ba59ad3e77937a49504f8903edca281b2..cbf171631958e461a1ab255642b90360f3d22e21 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/93964
+       * gcc.dg/graphite/pr93964.c: New testcase.
+
 2020-03-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/94001
diff --git a/gcc/testsuite/gcc.dg/graphite/pr93964.c b/gcc/testsuite/gcc.dg/graphite/pr93964.c
new file mode 100644 (file)
index 0000000..80fc523
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile }  */
+/* { dg-options "-O -floop-nest-optimize" } */
+
+int *
+eo (void);
+
+void
+g4 (int *nt)
+{
+  int dh, t2 = (__INTPTR_TYPE__)eo ();
+
+  for (dh = 0; dh < 2; ++dh)
+    {
+      int m7;
+
+      for (m7 = 0; m7 < t2; ++m7)
+        nt[m7] = 0;
+    }
+}