From 2a7b5baab4bd416cb299da41e5a74162bb8862a6 Mon Sep 17 00:00:00 2001 From: amker Date: Wed, 23 Mar 2016 15:24:20 +0000 Subject: [PATCH] PR tree-optimization/69042 * tree-ssa-loop-ivopts.c (add_iv_candidate_for_use): Add IV cand for use with constant offset stripped in base. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234429 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-loop-ivopts.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6538ff0..e035f1b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-03-23 Bin Cheng + + PR tree-optimization/69042 + * tree-ssa-loop-ivopts.c (add_iv_candidate_for_use): Add IV cand + for use with constant offset stripped in base. + 2016-03-23 Richard Biener PR middle-end/70251 diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 5302edf..99dd4d0 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3232,11 +3232,13 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) basetype = sizetype; record_common_cand (data, build_int_cst (basetype, 0), iv->step, use); - /* Record common candidate with constant offset stripped in base. */ + /* Record common candidate with constant offset stripped in base. + Like the use itself, we also add candidate directly for it. */ + base = strip_offset (iv->base, &offset); + if (offset || base != iv->base) { - base = strip_offset (iv->base, &offset); - if (offset || base != iv->base) - record_common_cand (data, base, iv->step, use); + record_common_cand (data, base, iv->step, use); + add_candidate (data, base, iv->step, false, use); } /* Record common candidate with base_object removed in base. */ -- 2.7.4