This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix up ivopts POINTER_TYPE_P handling (PR tree-optimization/77444)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Sep 2016 17:11:39 +0200
- Subject: [PATCH] Fix up ivopts POINTER_TYPE_P handling (PR tree-optimization/77444)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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