[Mlir-commits] [mlir] [mlir][bufferization] Expose checkPreBufferizationAssumptions helper (PR #221302)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Sep 4 10:54:03 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Colin De Vlieghere (Cubevoid)
<details>
<summary>Changes</summary>
Downstream users of bufferization may want to run this check without invoking the entire one-shot module analysis. If the check is not run and invalid IR is encountered, OneShotBufferize tends to crash rather than emitting a nice error message.
This patch simply exposes `checkPreBufferizationAssumptions` to the header file so it is accessible to other users.
---
Full diff: https://github.com/llvm/llvm-project/pull/221302.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h (+6)
- (modified) mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp (+2-5)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
index 34ce4fe456199..448c540df408e 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
@@ -272,6 +272,12 @@ class OneShotAnalysisState : public AnalysisState {
DenseMap<TypeID, std::unique_ptr<Extension>> extensions;
};
+/// Perform various checks on the input IR to see if it contains IR constructs
+/// that are unsupported by One-Shot Bufferize.
+LogicalResult
+checkPreBufferizationAssumptions(Operation *op, const DominanceInfo &domInfo,
+ OneShotAnalysisState &state);
+
/// Analyze `op` and its nested ops. Bufferization decisions are stored in
/// `state`.
LogicalResult analyzeOp(Operation *op, OneShotAnalysisState &state,
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
index 937a765d49ad8..e948a02cc415d 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
@@ -1185,11 +1185,8 @@ LogicalResult OneShotAnalysisState::analyzeOp(Operation *op,
return success();
}
-/// Perform various checks on the input IR to see if it contains IR constructs
-/// that are unsupported by One-Shot Bufferize.
-static LogicalResult
-checkPreBufferizationAssumptions(Operation *op, const DominanceInfo &domInfo,
- OneShotAnalysisState &state) {
+LogicalResult bufferization::checkPreBufferizationAssumptions(
+ Operation *op, const DominanceInfo &domInfo, OneShotAnalysisState &state) {
const BufferizationOptions &options = state.getOptions();
// Note: This walk cannot be combined with the one below because interface
``````````
</details>
https://github.com/llvm/llvm-project/pull/221302
More information about the Mlir-commits
mailing list