diff options
author | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-23 02:27:49 +0000 |
---|---|---|
committer | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-23 02:27:49 +0000 |
commit | 325ea54a05baf4e83011f1152adfb60bdd22181c (patch) | |
tree | ffd2829402bdcf622586bb911cac06f9cc617479 /gcc/tree-ssa-loop-niter.c | |
parent | 0f6714c2c2bcacfc25d5e720d75d099f5ffd2473 (diff) | |
download | gcc-325ea54a05baf4e83011f1152adfb60bdd22181c.tar.gz |
PR tree-optimization/66449
* tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
POINTER_PLUS_EXPR for pointers.
gcc/testsuite
PR tree-optimization/66449
* gcc.dg/vect/pr66449.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224769 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 213d72e3dc4..855d32ceeb0 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3888,7 +3888,12 @@ loop_exits_before_overflow (tree base, tree step, by proving the reverse conditions are false using loop's initial condition. */ - stepped = fold_build2 (PLUS_EXPR, TREE_TYPE (base), base, step); + if (POINTER_TYPE_P (TREE_TYPE (base))) + code = POINTER_PLUS_EXPR; + else + code = PLUS_EXPR; + + stepped = fold_build2 (code, TREE_TYPE (base), base, step); if (operand_equal_p (stepped, civ->base, 0)) { if (tree_int_cst_sign_bit (step)) |