https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120254
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Rohith Kapelli <[email protected]>: https://gcc.gnu.org/g:99126c684223cabab03e41e806616160b4058f73 commit r17-5774-g99126c684223cabab03e41e806616160b4058f73 Author: Rohith Kapelli <[email protected]> Date: Fri Oct 16 00:58:52 2026 +0530 tree-optimization/115869 - complete or drop the distance vectors of free loops Call a loop of the nest free when it contains both references and no compared access function evolves in it: the dependence can then have any distance in that loop. build_classic_dist_vector gives a free loop a distance of its own only when it is the only one and lies outside the loops the subscripts constrain; otherwise its distance is taken as zero, which misses the distances of opposite signs. Interchange and unroll-and-jam then reverse dependences that exist, as for structure accesses through objects that move in the nest (PR115869, PR105771) and for plain arrays (PR120254, PR109184). When the vectors agree up to sign in the constrained loops, add every lexicographically positive vector with -1, 0 or 1 in each free loop and the first vector's distances, or their opposite, in the other loops. For correctness the users need only the signs and the smallest distance in such a loop. Give up instead when the bases differ and the objects move in the nest, when the vectors disagree (as the vectors of add_multivariate_self_dist do, whose outer distances go one way only), when more than three loops are free, or when more than 32 vectors would be needed. PR tree-optimization/115869 PR tree-optimization/105771 PR tree-optimization/120254 PR tree-optimization/109184 gcc/ChangeLog: * tree-data-ref.cc (dist_vectors_agree_p): New function. (mark_evolving_loops): Likewise. (enum free_loop_distances): New. (check_free_loop_distances): New function. (add_free_loop_distances): Likewise. (subscript_dependence_tester): Complete the distance vectors of free loops, or give up. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr105771.c: New test. * gcc.dg/torture/pr109184.c: New test. * gcc.dg/torture/pr115869.c: New test. * gcc.dg/torture/pr115869-2.c: New test. * gcc.dg/torture/pr115869-3.c: New test. * gcc.dg/torture/pr115869-5.c: New test. * gcc.dg/torture/pr120254.c: New test. Signed-off-by: Rohith Kapelli <[email protected]>
