public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r8-10807] tree-optimization/93964 - adjust ISL code generation for pointer params
@ 2021-03-17 12:05 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-03-17 12:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5fb76d406e75acc7223df06b66b95e70705e1185

commit r8-10807-g5fb76d406e75acc7223df06b66b95e70705e1185
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Mar 4 10:40:32 2020 +0100

    tree-optimization/93964 - adjust ISL code generation for pointer params
    
    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.
    
    (cherry picked from commit bb0ec9cffb1d0a3326d8c4ed197717fc08eeec37)

Diff:
---
 gcc/graphite-isl-ast-to-gimple.c        |  3 +++
 gcc/graphite-scop-detection.c           |  1 -
 gcc/testsuite/gcc.dg/graphite/pr93964.c | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index b607b12434d..6d576dcb850 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -266,6 +266,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);
 }
 
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index fc717c5b242..934a927fc34 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1100,7 +1100,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;
diff --git a/gcc/testsuite/gcc.dg/graphite/pr93964.c b/gcc/testsuite/gcc.dg/graphite/pr93964.c
new file mode 100644
index 00000000000..80fc523b855
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr93964.c
@@ -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;
+    }
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-17 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 12:05 [gcc r8-10807] tree-optimization/93964 - adjust ISL code generation for pointer params Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).