Skip to content

Commit

Permalink
Harden -slice-analysis-test MLIR testing pass to check for some invar…
Browse files Browse the repository at this point in the history
…iants

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
  • Loading branch information
joker-eph committed Jan 18, 2023
1 parent 11a9c05 commit c114dba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mlir/test/lib/IR/TestSlicing.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit c114dba

Please sign in to comment.