On Mon, 13 Apr 2015, Jakub Jelinek wrote:

> On Mon, Apr 13, 2015 at 05:46:35PM +0200, Toon Moene wrote:
> > [ Patch elided ]
> > 
> > The patch applied cleanly - this is what I got as a result:
> > 
> > https://gcc.gnu.org/ml/gcc-testresults/2015-04/msg01450.html
> > 
> > I hope this is useful.
> 
> Looks like the http://gcc.gnu.org/ml/gcc-patches/2014-08/msg01014.html
> patch is bad, including a header of one particular FE in the middle-end
> is just wrong.
> 
> #define TYPE_PTR_P(NODE)                        \
>   (TREE_CODE (NODE) == POINTER_TYPE)
> 
> #define TYPE_OBJ_P(NODE)                        \
>   (TREE_CODE (NODE) != REFERENCE_TYPE           \
>    && !VOID_TYPE_P (NODE)                       \
>    && TREE_CODE (NODE) != FUNCTION_TYPE         \
>    && TREE_CODE (NODE) != METHOD_TYPE)
> 
> #define TYPE_PTROB_P(NODE)                                      \
>   (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
> 
> is nothing that one couldn't just open-code in the middle-end,
> like
>   if (TREE_CODE (scev) == SSA_NAME
>       && TREE_CODE (TREE_TYPE (scev)) == POINTER_TYPE
>       && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != REFERENCE_TYPE
>       && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE ((scev))))
>       && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != FUNCTION_TYPE
>       && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != METHOD_TYPE)
> but it is unclear why you want this check.  For the middle-end, most pointer
> conversions are useless, so the distinction between pointers to objects and
> pointers to something different, might be long time lost.
> Don't you want just
>   if (TREE_CODE (scev) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (scev)))
> instead (i.e. just give up on all pointers/references)?  That is what the
> middle-end usually tests...

I am testing the following.

Richard.

2015-04-14  Richard Biener  <rguent...@suse.de>

        * graphite-scop-detection.c: Do not include cp/cp-tree.h.
        (graphite_can_represent_scev): Use POINTER_TYPE_P.

Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c       (revision 222076)
+++ gcc/graphite-scop-detection.c       (working copy)
@@ -70,7 +70,6 @@ along with GCC; see the file COPYING3.
 #include "tree-pass.h"
 #include "sese.h"
 #include "tree-ssa-propagate.h"
-#include "cp/cp-tree.h"
 
 #ifdef HAVE_isl
 #include "graphite-poly.h"
@@ -239,7 +238,7 @@ graphite_can_represent_scev (tree scev)
      the only nodes, which are disabled in case they are pointers to object
      types, but this can be changed.  */
 
-  if (TYPE_PTROB_P (TREE_TYPE (scev)) && TREE_CODE (scev) == SSA_NAME)
+  if (POINTER_TYPE_P (TREE_TYPE (scev)) && TREE_CODE (scev) == SSA_NAME)
     return false;
 
   switch (TREE_CODE (scev))

Reply via email to