[Mlir-commits] [mlir] d1d7992 - [mlir][bufferize][NFC] Better error messages if analysis fails

Matthias Springer llvmlistbot at llvm.org
Tue Mar 8 02:50:07 PST 2022


Author: Matthias Springer
Date: 2022-03-08T19:45:00+09:00
New Revision: d1d79920f7e069ede7e2549e00f81a1b3eaa198f

URL: https://github.com/llvm/llvm-project/commit/d1d79920f7e069ede7e2549e00f81a1b3eaa198f
DIFF: https://github.com/llvm/llvm-project/commit/d1d79920f7e069ede7e2549e00f81a1b3eaa198f.diff

LOG: [mlir][bufferize][NFC] Better error messages if analysis fails

Differential Revision: https://reviews.llvm.org/D121203

Added: 
    

Modified: 
    mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
index 340f28526b2d2..efe7e36956c74 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
@@ -773,30 +773,27 @@ LogicalResult bufferization::analyzeOp(Operation *op,
     equivalenceAnalysis(newOps, aliasInfo, state);
   }
 
+  bool failedAnalysis = false;
   if (!options.allowReturnMemref) {
     SmallVector<Operation *> newOps;
-    if (failed(assertDestinationPassingStyle(op, state, aliasInfo, newOps)))
-      return failure();
+    failedAnalysis |=
+        failed(assertDestinationPassingStyle(op, state, aliasInfo, newOps));
   }
 
   // Analysis verification: After setting up alias/equivalence sets, each op
   // can check for expected invariants/limitations and fail the analysis if
   // necessary.
-  bool passedAnalysis = true;
   op->walk([&](Operation *op) {
     if (BufferizableOpInterface bufferizableOp =
             options.dynCastBufferizableOp(op))
-      if (failed(bufferizableOp.verifyAnalysis(state)))
-        passedAnalysis = false;
+      failedAnalysis |= failed(bufferizableOp.verifyAnalysis(state));
   });
-  if (!passedAnalysis)
-    return failure();
 
   // Annotate operations if we only want to report the analysis.
   if (options.testAnalysisOnly)
     annotateOpsWithBufferizationMarkers(op, aliasInfo, state);
 
-  return success();
+  return success(!failedAnalysis);
 }
 
 LogicalResult bufferization::runOneShotBufferize(


        


More information about the Mlir-commits mailing list