[Mlir-commits] [mlir] c114dba - Harden -slice-analysis-test MLIR testing pass to check for some invariants

Mehdi Amini llvmlistbot at llvm.org
Wed Jan 18 06:16:55 PST 2023


Author: Mehdi Amini
Date: 2023-01-18T14:16:40Z
New Revision: c114dba3f3e1ccd342bf249b08c94caceb7b776b

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

LOG: Harden -slice-analysis-test MLIR testing pass to check for some invariants

The pass would assert on some input IR that it didn't expect. Instead
signal a pass failure and properly interupt the flow.

Fixes #60022

Added: 
    

Modified: 
    mlir/test/lib/IR/TestSlicing.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/IR/TestSlicing.cpp b/mlir/test/lib/IR/TestSlicing.cpp
index 78c8ff7d46015..3388b972880e3 100644
--- a/mlir/test/lib/IR/TestSlicing.cpp
+++ b/mlir/test/lib/IR/TestSlicing.cpp
@@ -64,6 +64,11 @@ void SliceAnalysisTestPass::runOnOperation() {
   auto funcOps = module.getOps<func::FuncOp>();
   unsigned opNum = 0;
   for (auto funcOp : funcOps) {
+    if (!llvm::hasSingleElement(funcOp.getBody())) {
+      funcOp->emitOpError("Does not support functions with multiple blocks");
+      signalPassFailure();
+      return;
+    }
     // TODO: For now this is just looking for Linalg ops. It can be generalized
     // to look for other ops using flags.
     funcOp.walk([&](Operation *op) {


        


More information about the Mlir-commits mailing list