Re: [PATCH] Fix up ivopts POINTER_TYPE_P handling (PR tree-optimization/77444)

2016-09-02 Thread Richard Biener
On September 2, 2016 5:11:39 PM GMT+02:00, Jakub Jelinek  
wrote:
>Hi!
>
>I've looked a little bit at svn blame and we had:
>  tree steptype = type;
>  if (POINTER_TYPE_P (type))
>steptype = sizetype;
>there initially and the
>  steptype = unsigned_type_for (type);
>has been added later on in r209190, without cleaning up the earlier
>stmts.
>I think for POINTER_TYPE_P it is better to use sizetype instead of
>nonstandard integer type with TYPE_PRECISION of pointer types.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Richard.

>2016-09-02  Jakub Jelinek  
>   Richard Biener  
>
>   PR tree-optimization/77444
>   * tree-ssa-loop-ivopts.c (cand_value_at): For pointers use sizetype
>   as steptype, remove redundant initialization.
>
>--- gcc/tree-ssa-loop-ivopts.c.jj  2016-07-21 08:59:55.0 +0200
>+++ gcc/tree-ssa-loop-ivopts.c 2016-09-02 14:18:09.0 +0200
>@@ -5168,10 +5168,11 @@ cand_value_at (struct loop *loop, struct
>   aff_tree step, delta, nit;
>   struct iv *iv = cand->iv;
>   tree type = TREE_TYPE (iv->base);
>-  tree steptype = type;
>+  tree steptype;
>   if (POINTER_TYPE_P (type))
> steptype = sizetype;
>-  steptype = unsigned_type_for (type);
>+  else
>+steptype = unsigned_type_for (type);
> 
>   tree_to_aff_combination (iv->step, TREE_TYPE (iv->step), &step);
>   aff_combination_convert (&step, steptype);
>
>   Jakub




[PATCH] Fix up ivopts POINTER_TYPE_P handling (PR tree-optimization/77444)

2016-09-02 Thread Jakub Jelinek
Hi!

I've looked a little bit at svn blame and we had:
  tree steptype = type;
  if (POINTER_TYPE_P (type))
steptype = sizetype;
there initially and the
  steptype = unsigned_type_for (type);
has been added later on in r209190, without cleaning up the earlier stmts.
I think for POINTER_TYPE_P it is better to use sizetype instead of
nonstandard integer type with TYPE_PRECISION of pointer types.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-09-02  Jakub Jelinek  
Richard Biener  

PR tree-optimization/77444
* tree-ssa-loop-ivopts.c (cand_value_at): For pointers use sizetype
as steptype, remove redundant initialization.

--- gcc/tree-ssa-loop-ivopts.c.jj   2016-07-21 08:59:55.0 +0200
+++ gcc/tree-ssa-loop-ivopts.c  2016-09-02 14:18:09.0 +0200
@@ -5168,10 +5168,11 @@ cand_value_at (struct loop *loop, struct
   aff_tree step, delta, nit;
   struct iv *iv = cand->iv;
   tree type = TREE_TYPE (iv->base);
-  tree steptype = type;
+  tree steptype;
   if (POINTER_TYPE_P (type))
 steptype = sizetype;
-  steptype = unsigned_type_for (type);
+  else
+steptype = unsigned_type_for (type);
 
   tree_to_aff_combination (iv->step, TREE_TYPE (iv->step), &step);
   aff_combination_convert (&step, steptype);

Jakub