On Mon, Apr 1, 2019 at 5:10 AM bin.cheng <bin.ch...@linux.alibaba.com> wrote: > > Hi, > > As described in comments of PR89725, this patch fixes out-of-bound access > during > computing classic dist/dir vector for DDR. Basically it does two things: A) > Handle > relevant chrec of outer loop in multivariate access function as invariant > symbol during > DDR analysis; B) Bypass relevant univariate access functions. > > Bootstrap and test on x86_64, any comments?
LGTM, as Jakub said elsewhere index_in_loop_nest is better written as static inline int index_in_loop_nest (int var, vec<loop_p> loop_nest) { struct loop *loopi; int var_index; for (var_index = 0; loop_nest.iterate (var_index, &loopi); var_index++) if (loopi->num == var) return var_index; gcc_unreachable (); } OK with that change. Richard. > Thanks, > bin > > 2019-04-01 Bin Cheng <bin.ch...@linux.alibaba.com> > > PR tree-optimization/89725 > * tree-chrec.c (chrec_contains_symbols): New parameter. Handle outer > loop's chrec as invariant symbol. > * tree-chrec.h (chrec_contains_symbols): New parameter. > * tree-data-ref.c (analyze_miv_subscript): Pass new argument. > (build_classic_dist_vector_1, add_other_self_distances): Bypass access > function of loops not in DDR's loop_nest. > * tree-data-ref.h (index_in_loop_nest): New assertion. > > 2018-04-01 Bin Cheng <bin.ch...@linux.alibaba.com> > > PR tree-optimization/89725 > * gcc/testsuite/gcc.dg/tree-ssa/pr89725.c: New test.