summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-04 09:23:27 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-04 09:23:27 +0000
commita50fd9b79dc2079fb10d5c4fb6ca184926e12a45 (patch)
treef4c608a38d8dd3ec5a49c5ad456f0376da36c5d9 /gcc/tree-ssa-loop-niter.c
parent54459dd6822c5750bac14c9940dc40101f282bf6 (diff)
downloadgcc-a50fd9b79dc2079fb10d5c4fb6ca184926e12a45.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188169 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index c7c4a15bef4..501c431d4c8 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;
}