The dependence analysis was returning incorrect information when using the GEPs to compute the dependence. The analysis uses the GEP indices to perform the check under certain conditions. It incorrectly does this if the base objects are aliases, but are actually pointing to different locations in an array. Because the SCEVs for the GEPs indices were the same, DA returns a distance of 0.
This patch adds another check for the base objects. If the SCEVs for the base pointers are compared, using getMinusSCEV() and the value is not 0, the analysis should fall back on the path that uses the whole SCEV for the dependence check. Not just the GEP indices.
Fixes bug 33567.
Why did you choose to look at the difference instead of checking isKnownPredicate? Is there an advantage in looking at the difference? isKnownPredicate would communicate to the reader better the intention of this check.