[Mlir-commits] [mlir] [mlir][SCF] Fix dynamic loop pipeline peeling for num_stages > total_iters (PR #112418)

Thomas Raoux llvmlistbot at llvm.org
Tue Oct 15 12:05:20 PDT 2024


================
@@ -642,48 +642,57 @@ LogicalResult
 LoopPipelinerInternal::emitEpilogue(RewriterBase &rewriter,
                                     llvm::SmallVector<Value> &returnValues) {
   Location loc = forOp.getLoc();
+  Type t = lb.getType();
+
   // Emit different versions of the induction variable. They will be
   // removed by dead code if not used.
 
-  // bounds_range = ub - lb
-  // total_iterations = (bounds_range + step - 1) / step
-  Type t = lb.getType();
-  Value zero =
-      rewriter.create<arith::ConstantOp>(loc, rewriter.getIntegerAttr(t, 0));
-  Value one =
-      rewriter.create<arith::ConstantOp>(loc, rewriter.getIntegerAttr(t, 1));
-  Value minusOne =
-      rewriter.create<arith::ConstantOp>(loc, rewriter.getIntegerAttr(t, -1));
+  auto getConst = [&](int v) {
----------------
ThomasRaoux wrote:

nit: maybe rename to `createConst`?

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


More information about the Mlir-commits mailing list