[Mlir-commits] [mlir] [MLIR][Affine] Fix isTilingValid missing anti-dependence when lb == ub < 0 (PR #192858)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon May 4 19:45:59 PDT 2026


================
@@ -557,7 +557,7 @@ bool mlir::affine::isTilingValid(ArrayRef<AffineForOp> loops) {
                               OpPrintingFlags().skipRegions());
         for (const DependenceComponent &depComp : depComps) {
           if (depComp.lb.has_value() && depComp.ub.has_value() &&
-              *depComp.lb < *depComp.ub && *depComp.ub < 0) {
+              *depComp.lb <= *depComp.ub && *depComp.ub < 0) {
----------------
Mountagha wrote:

I agree that checking lb < 0 would catch cases where a negative component is possible, and that makes sense from a correctness standpoint.

That said, I wonder if this might be overly conservative. For intervals like [-2, 1], the analysis is saying the dependence could be negative, but also could be non-negative. Rejecting purely based on lb < 0 would rule out such cases even when the actual dependence is forward.

https://github.com/llvm/llvm-project/pull/192858


More information about the Mlir-commits mailing list