[Mlir-commits] [mlir] 0c36082 - [mlir][SCF] Use symbols in loop peeling rewrite

Matthias Springer llvmlistbot at llvm.org
Tue Aug 24 03:39:37 PDT 2021


Author: Matthias Springer
Date: 2021-08-24T19:39:19+09:00
New Revision: 0c36082963fad031bf0740ed32ad35d8fa5ea70e

URL: https://github.com/llvm/llvm-project/commit/0c36082963fad031bf0740ed32ad35d8fa5ea70e
DIFF: https://github.com/llvm/llvm-project/commit/0c36082963fad031bf0740ed32ad35d8fa5ea70e.diff

LOG: [mlir][SCF] Use symbols in loop peeling rewrite

Use symbols in the affine map instead of dims. Dims should not be divided.

Differential Revision: https://reviews.llvm.org/D108431

Added: 
    

Modified: 
    mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index 03c55fdf7f099..1cac3444c42fa 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -121,10 +121,10 @@ static LogicalResult peelForLoop(RewriterBase &b, ForOp forOp, scf::IfOp &ifOp,
     return failure();
 
   auto loc = forOp.getLoc();
-  AffineExpr dim0, dim1, dim2;
-  bindDims(b.getContext(), dim0, dim1, dim2);
+  AffineExpr sym0, sym1, sym2;
+  bindSymbols(b.getContext(), sym0, sym1, sym2);
   // New upper bound: %ub - (%ub - %lb) mod %step
-  auto modMap = AffineMap::get(3, 0, {dim1 - ((dim1 - dim0) % dim2)});
+  auto modMap = AffineMap::get(0, 3, {sym1 - ((sym1 - sym0) % sym2)});
   b.setInsertionPoint(forOp);
   splitBound = b.createOrFold<AffineApplyOp>(
       loc, modMap,


        


More information about the Mlir-commits mailing list