From f7c589d3e74ff4b06452ecbc94c6bc0dcbc8a09e Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 13 Jan 2022 18:43:18 +0000 Subject: [PATCH] Clarify that fold() can't "erase" an operation in the MLIR Canonicalization doc (NFC) --- mlir/docs/Canonicalization.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mlir/docs/Canonicalization.md b/mlir/docs/Canonicalization.md index 1b017ad..9630497 100644 --- a/mlir/docs/Canonicalization.md +++ b/mlir/docs/Canonicalization.md @@ -111,10 +111,11 @@ mechanism, and can be invoked directly anywhere with an `OpBuilder` via `OpBuilder::createOrFold`. `fold` has the restriction that no new operations may be created, and only the -root operation may be replaced. It allows for updating an operation in-place, or -returning a set of pre-existing values (or attributes) to replace the operation -with. This ensures that the `fold` method is a truly "local" transformation, and -can be invoked without the need for a pattern rewriter. +root operation may be replaced (but not erased). It allows for updating an +operation in-place, or returning a set of pre-existing values (or attributes) to +replace the operation with. This ensures that the `fold` method is a truly +"local" transformation, and can be invoked without the need for a pattern +rewriter. In [ODS](OpDefinitions.md), an operation can set the `hasFolder` bit to generate a declaration for the `fold` method. This method takes on a different form, -- 2.7.4