It turns out we can't depend on loop index numbers being in any
particular order.
When it didn't happen, like the testcase in 18792,
This fixes it to use loop depth as the index into the distance and
direction vectors when building them, as well as fixing the parts of
tree-loop-linear that indexed into those arrays
This should work, as the function already assumes there are no sibling
loops in the nest, etc.
Bootstrapped and regtested on i686-pc-linux-gnu.
Okay for mainline?
2004-12-07 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/18792
* tree-data-ref.c (build_classic_dist_vector): Change first_loop
to first_loop_depth, and use loop depth instead of loop number.
(build_classic_dir_vector): Ditto.
(compute_data_dependences_for_loop): Use depth, not loop number.
* tree-loop-linear.c (try_interchange_loops): Use loop depth, not loop
number. Pass in loops, instead of loop numbers.
(gather_interchange_stats): Ditto.
(linear_transform_loops): Ditto.