[RFC] A New Pass as an Alternative to DependenceAnalysis

Rewriting DA from scratch is a big task and be looking forward to see it and not go the way of NewGVN.

Unify all integer interpretation as signed

This would mean bail out on any for (size_t i = 0; i < n; ++i). The pattern is too common to just ignore.

Have you considered adding a bit (i.e. i32 → i33) for unsigned values? Since the dependence-test is a yes/no/maybe answer, that wouldn’t be visible from the outside.

Parametric delinearization

I think the multi-dimensional array issue can only be satisfyingly solved with additional information from the frontend. I would suggest to plan for an ability to use such information, such as structural GEP.

Subscripts containing SCEVUnknown

I think handling of some SCEVUnknown that are invariant to the loops is necessary for a lot of use-cases. This is often a function parameter. E.g., we want to be able to determine that A[x] and A[x+1] do not alias.

Several test routines

:+1: Additional tests can always be added into a working implementation

Constraint propagation

Does this include removing assumptions? Emitting runtime-checks from SCEVPredicate would allow applying an optimization only for such cases where the contraints are true. E.g. to allow an optimization for unsigned types, as long as its value at runtime remains in the “non-negative” range.