[Mlir-commits] [mlir] [mlir] Add forall canonicalization to replace constant induction vars (PR #112764)

Han-Chung Wang llvmlistbot at llvm.org
Thu Oct 17 14:57:22 PDT 2024


================
@@ -1767,6 +1767,32 @@ struct ForallOpSingleOrZeroIterationDimsFolder
   }
 };
 
+struct ForallOpReplaceConstantInductionVar : public OpRewritePattern<ForallOp> {
+  using OpRewritePattern<ForallOp>::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(ForallOp op,
+                                PatternRewriter &rewriter) const override {
+    // Replace all induction vars with a single trip count with their lower
+    // bound.
----------------
hanhanW wrote:

Sorry that I did not point it out in the previous review. Do we move this comment to be the pattern comment? E.g.,

```cpp
/// Replace all induction vars with a single trip count with their lower bound.
struct ForallOpReplaceConstantInductionVar : public OpRewritePattern<ForallOp> {
// ...
```

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


More information about the Mlir-commits mailing list