[Mlir-commits] [mlir] 767974f - [mlir][scf] Fix bug in peelForLoop

Matthias Springer llvmlistbot at llvm.org
Tue Aug 3 18:29:12 PDT 2021


Author: Matthias Springer
Date: 2021-08-04T10:20:46+09:00
New Revision: 767974f344ed0682b454a479c28284377070cf05

URL: https://github.com/llvm/llvm-project/commit/767974f344ed0682b454a479c28284377070cf05
DIFF: https://github.com/llvm/llvm-project/commit/767974f344ed0682b454a479c28284377070cf05.diff

LOG: [mlir][scf] Fix bug in peelForLoop

Insertion point should be set before creating new operations.

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

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 f086f15ac7444..f4045d087d1c1 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -116,6 +116,7 @@ LogicalResult mlir::scf::peelForLoop(RewriterBase &b, ForOp forOp,
   bindDims(b.getContext(), dim0, dim1, dim2);
   // New upper bound: %ub - (%ub - %lb) mod %step
   auto modMap = AffineMap::get(3, 0, {dim1 - ((dim1 - dim0) % dim2)});
+  b.setInsertionPoint(forOp);
   Value splitBound = b.createOrFold<AffineApplyOp>(
       loc, modMap,
       ValueRange{forOp.lowerBound(), forOp.upperBound(), forOp.step()});


        


More information about the Mlir-commits mailing list