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

Jakub Jelinek jakub@redhat.com
Fri Sep 2 15:11:00 GMT 2016


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.

--- 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



More information about the Gcc-patches mailing list