[Mlir-commits] [mlir] [mlir][bufferization] Expose checkPreBufferizationAssumptions helper (PR #221302)

Colin De Vlieghere llvmlistbot at llvm.org
Fri Sep 4 11:04:40 PDT 2026


https://github.com/Cubevoid updated https://github.com/llvm/llvm-project/pull/221302

>From baea44fd3144336246d7592d6a0cfc39edcb65c2 Mon Sep 17 00:00:00 2001
From: Colin De Vlieghere <cdevlieghere at tesla.com>
Date: Fri, 4 Sep 2026 10:49:56 -0700
Subject: [PATCH] [mlir][bufferization] Expose checkPreBufferizationAssumptions
 helper

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.
---
 .../Dialect/Bufferization/Transforms/OneShotAnalysis.h     | 6 ++++++
 .../Dialect/Bufferization/Transforms/OneShotAnalysis.cpp   | 7 ++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
index 34ce4fe456199..49706c5614d83 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



More information about the Mlir-commits mailing list