Affine scalar replacement (and other affine passes, though not fixed here) don't properly handle operations with nested regions. This patch fixes the pass and two affine utilities to function properly given a non-affine internal region.
This patch prevents the pass from throwing an internal compiler error when running on the added test case.
should be >. A loop nest of depth 2 can have dependence at 3 different levels. Here all the stores have dependence into the following load, at different depths. First store: depth 1, second store: depth 2, third store: depth 3:
You can take a look at addOrderingConstraints function in lib/Analysis/AffineAnalysis.cpp for better understanding.