[Mlir-commits] [mlir] [MLIR] Clarify createOrFold as opportunistic eager folding (PR #160565)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 24 10:17:11 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
Author: NohHyeon Kwon (swote-git)
<details>
<summary>Changes</summary>
This PR addresses the documentation aspect of #<!-- -->159844 by clarifying the opportunistic nature of `createOrFold`, as discussed with @<!-- -->joker-eph.
This addresses user confusion about createOrFold behavior compared to canonicalization passes.
---
Full diff: https://github.com/llvm/llvm-project/pull/160565.diff
1 Files Affected:
- (modified) mlir/include/mlir/IR/Builders.h (+3)
``````````diff
diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h
index ad59ea63a6901..7a137125eb440 100644
--- a/mlir/include/mlir/IR/Builders.h
+++ b/mlir/include/mlir/IR/Builders.h
@@ -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.
template <typename OpTy, typename... Args>
void createOrFold(SmallVectorImpl<Value> &results, Location location,
Args &&...args) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/160565
More information about the Mlir-commits
mailing list