[libc-commits] [lld] [llvm] [clang] [lldb] [mlir] [compiler-rt] [clang-tools-extra] [libcxx] [libc] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

Matthias Springer via libc-commits libc-commits at lists.llvm.org
Fri Jan 5 09:00:16 PST 2024


================
@@ -206,6 +206,34 @@ transform::LoopPeelOp::applyToOne(transform::TransformRewriter &rewriter,
   return DiagnosedSilenceableFailure::success();
 }
 
+//===---------------------------------------------------------------------===//
+// LoopContinuousPeelOp
+//===---------------------------------------------------------------------===//
+
+DiagnosedSilenceableFailure transform::LoopContinuousPeelOp::applyToOne(
+    transform::TransformRewriter &rewriter, Operation *target,
+    transform::ApplyToEachResultList &results,
+    transform::TransformState &state) {
+  scf::ForOp loop, result;
+  loop = dyn_cast<scf::ForOp>(target);
+  bool convertSingleIterLoopsToIf = false;
+
+  if (getConvertSingleIterLoopsToIf())
+    convertSingleIterLoopsToIf = true;
+
+  LogicalResult status = scf::continuousPeelForLoopAndSimplifyBounds(
+      rewriter, loop, result, convertSingleIterLoopsToIf);
----------------
matthias-springer wrote:

You can use `getConvertSingleIterLoopsToIf()` directly here.

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


More information about the libc-commits mailing list