diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-06-04 11:23:27 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-06-04 11:23:27 +0200 |
commit | 5ece98479f869dfda91d31c0907b8e97d996c60b (patch) | |
tree | f4c608a38d8dd3ec5a49c5ad456f0376da36c5d9 /gcc/tree-ssa-loop-niter.c | |
parent | c014f6f54b11651b253192956ef16bdc12a4ddaa (diff) | |
download | gcc-5ece98479f869dfda91d31c0907b8e97d996c60b.zip gcc-5ece98479f869dfda91d31c0907b8e97d996c60b.tar.gz gcc-5ece98479f869dfda91d31c0907b8e97d996c60b.tar.bz2 |
re PR tree-optimization/53550 (ICE with -O{1,2,3} -fprefetch-loop-arrays in build2_stat, at tree.c:3803)
PR tree-optimization/53550
* tree-ssa-loop-niter.c (number_of_iterations_cond): If type
is POINTER_TYPE_P, use sizetype as step type instead of type.
* gcc.dg/pr53550.c: New test.
From-SVN: r188169
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index c7c4a15..501c431 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1275,13 +1275,14 @@ number_of_iterations_cond (struct loop *loop, practice, but it is simple enough to manage. */ if (!integer_zerop (iv0->step) && !integer_zerop (iv1->step)) { + tree step_type = POINTER_TYPE_P (type) ? sizetype : type; if (code != NE_EXPR) return false; - iv0->step = fold_binary_to_constant (MINUS_EXPR, type, + iv0->step = fold_binary_to_constant (MINUS_EXPR, step_type, iv0->step, iv1->step); iv0->no_overflow = false; - iv1->step = build_int_cst (type, 0); + iv1->step = build_int_cst (step_type, 0); iv1->no_overflow = true; } |