[Mlir-commits] [mlir] [MLIR] Clarify createOrFold as opportunistic eager folding (PR #160565)

Mehdi Amini llvmlistbot at llvm.org
Wed Sep 24 14:15:54 PDT 2025


================
@@ -513,6 +513,9 @@ class OpBuilder : public Builder {
   /// Create an operation of specific op type at the current insertion point,
   /// and immediately try to fold it. This functions populates 'results' with
   /// the results of the operation.
+  ///
+  /// Note: This performs opportunistic eager folding during IR construction,
+  /// attempting optimization only once without iterative refinement.
----------------
joker-eph wrote:

```suggestion
  /// Note: This performs opportunistic eager folding during IR construction.
  /// The folders are designed to operate efficiently on canonical IR, which this
  /// API does not enforce. Complete folding isn't only expected in the context
  /// of canonicalization which intertwine folders with pattern rewrites until
  /// fixed-point.
```


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


More information about the Mlir-commits mailing list