diff mbox

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

Message ID 20160902151139.GG14857@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 2, 2016, 3:11 p.m. UTC
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  <jakub@redhat.com>
	    Richard Biener  <rguenth@suse.de>

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


	Jakub

Comments

Richard Biener Sept. 2, 2016, 4:48 p.m. UTC | #1
On September 2, 2016 5:11:39 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> 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  <jakub@redhat.com>
>	    Richard Biener  <rguenth@suse.de>
>
>	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.000000000 +0200
>+++ gcc/tree-ssa-loop-ivopts.c	2016-09-02 14:18:09.000000000 +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
diff mbox

Patch

--- gcc/tree-ssa-loop-ivopts.c.jj	2016-07-21 08:59:55.000000000 +0200
+++ gcc/tree-ssa-loop-ivopts.c	2016-09-02 14:18:09.000000000 +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);