For a SCEV range, this patch replaces the naive emptiness check for SCEV ranges
which looks like Begin == End with a SCEV check. The range is guaranteed to be
empty of Begin >= End. We should filter such ranges out and do not try to perform
IRCE for them.
For example, we can get such range when intersecting range [A, B) and [C, D)
where A < B < C < D. The resulting range is [max(A, C), min(B, D)) = [C, B).
This range is empty, but its Begin does not match with End.
Making IRCE for an empty range is basically safe, but unprofitable because we
never actually get into the main loop where the range checks are supposed to
be eliminated. This patch uses SCEV mechanisms to treat loops with proved
Begin >= End as empty.
SCEV's isKnownPredicate is actually really good in most cases to identify the empty range (BEGIN >= END).
However, there's a stronger version of isKnownPredicate in DependenceInfo::isKnownPredicate.
Specifically, it first checks SCEV's version of isKnownPredicate and if it fails, it does a further analysis using the Delta between Begin and End and checking the Delta based on the predicate passed in.
I'm wondering if SCEV's form maybe weaker and hence we may fire the assert added about empty ranges at line 1756?