From 7eeef08ed83f2bd341dc420adc6402199ccbdd7d Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 4 Aug 2008 18:35:20 +0000 Subject: [PATCH] tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add the candidate with the stripped base if... 2008-08-04 Richard Guenther * 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 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-loop-ivopts.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 224764ef985..02ca43300fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-04 Richard Guenther + + * 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. + 2008-08-04 Richard Guenther PR middle-end/36691 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); }