[Mlir-commits] [mlir] [MLIR] Harmonize the behavior of the folding API functions (PR #88508)

Matthias Springer llvmlistbot at llvm.org
Mon Apr 22 09:58:35 PDT 2024


================
@@ -1167,6 +1167,12 @@ struct TestLegalizePatternDriver
     target.addDynamicallyLegalOp<TestRecursiveRewriteOp>(
         [](TestRecursiveRewriteOp op) { return op.getDepth() == 0; });
 
+    // Create a dynamically legal rule that can only be legalized by folding it.
+    target.addDynamicallyLegalOp<TestOpInPlaceSelfFold>(
+        [](TestOpInPlaceSelfFold op) {
+          return op.getProperties().folded != nullptr;
----------------
matthias-springer wrote:

When this is a unit attr, you can write `return op.getFolded();`.

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


More information about the Mlir-commits mailing list