aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-04 18:35:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-04 18:35:20 +0000
commit7eeef08ed83f2bd341dc420adc6402199ccbdd7d (patch)
tree55b52bec69bc8c8d01185d71e8d9fad6eb7e5930 /gcc/tree-ssa-loop-ivopts.c
parent8f45dcf8be0e2bc9c91674d89636a1abe3f6bc92 (diff)
downloadgcc-7eeef08ed83f2bd341dc420adc6402199ccbdd7d.zip
gcc-7eeef08ed83f2bd341dc420adc6402199ccbdd7d.tar.gz
gcc-7eeef08ed83f2bd341dc420adc6402199ccbdd7d.tar.bz2
tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add the candidate with the stripped base if...
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. From-SVN: r138647
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 c314da4..1a1e58b 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);
}