[Mlir-commits] [mlir] [MLIR][SCF] Define `scf.while` rotation pass (PR #99850)

Victor Perez llvmlistbot at llvm.org
Mon Jul 22 01:57:53 PDT 2024


================
@@ -85,6 +86,10 @@ void populateSCFForLoopCanonicalizationPatterns(RewritePatternSet &patterns);
 ///  * `after` block containing arith.addi
 void populateUpliftWhileToForPatterns(RewritePatternSet &patterns);
 
+/// Populate patterns to rotate `scf.while` ops, constructing `do-while` loops
+/// from `while` loops.
+void populateSCFRotateWhileLoopPatterns(
+    RewritePatternSet &patterns, const SCFRotateWhileLoopPassOptions &options);
----------------
victor-eds wrote:

This currently has a limitation: we cannot apply the pattern recursively on newly created ops in a pass when `forceCreateCheck`. I left it as is as I am not aware of what's the "canonical" approach here. I'm using `GreedyRewriteStrictness::ExistingOps` in the pass, but passes calling this may not wanna do that.

We could either document that here or add an anonymous attribute to output `scf.while` operations to avoid infinite recursion.

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


More information about the Mlir-commits mailing list