https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89725
--- Comment #11 from bin cheng <amker at gcc dot gnu.org> --- In case of data reference has more access functions than loop_nest of data dependence analysis, we need to skip/ignore access functions corresponding loops not in the loop_nest. So far this only happens in loop interchange since we want to reuse data references collected in outer loop. During computing classic dist/dir vector, we need to avoid out-of-bound memory access. Univariate SCEV can be simply bypassed by checking the loop/chrec_variable as patch in comment #7. Of course, add_other_self_distances needs to be handled as well. On the other hand, bypassing multivariate would be harder and the impact is not yet clear, however, we can take another strategy handling SCEV of outer loop as invariant (symbol) to loop_nest during dependence analysis. As a matter of fact, current code already does in various places, i.e, with calling to evolution_function_is_invariant_rec_p etc. After scanning, I think the only piece missing is in analyze_miv_subscript. I am testing a patch.