summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 18:35:20 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 18:35:20 +0000
commit0cfdcbde72ceea7dec504f270427cb3550674694 (patch)
tree55b52bec69bc8c8d01185d71e8d9fad6eb7e5930 /gcc/tree-ssa-loop-ivopts.c
parentdd7d1eeb56a38857423c6d830b4c3cce82c8f3a7 (diff)
downloadgcc-0cfdcbde72ceea7dec504f270427cb3550674694.tar.gz
2008-08-04 Richard Guenther <rguenther@suse.de>
* tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add the candidate with the stripped base if that base is different from the original base even for offset zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138647 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index c314da49f94..1a1e58b1a81 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -2275,9 +2275,11 @@ add_iv_value_candidates (struct ivopts_data *data,
add_candidate (data, build_int_cst (basetype, 0),
iv->step, true, use);
- /* Third, try removing the constant offset. */
+ /* Third, try removing the constant offset. Make sure to even
+ add a candidate for &a[0] vs. (T *)&a. */
base = strip_offset (iv->base, &offset);
- if (offset)
+ if (offset
+ || base != iv->base)
add_candidate (data, base, iv->step, false, use);
}