Use Recursive Legality in sequencer lowering
This marks an operation, in this case MultiArchExecutable, as having an opaque region that should not be converted. It allows us to replace explicitly extracting only the functions from the module.
PiperOrigin-RevId: 277176736
diff --git a/iree/compiler/Transforms/Sequencer/LowerSequencerDialect.cpp b/iree/compiler/Transforms/Sequencer/LowerSequencerDialect.cpp
index ea3efa6..435cc57 100644
--- a/iree/compiler/Transforms/Sequencer/LowerSequencerDialect.cpp
+++ b/iree/compiler/Transforms/Sequencer/LowerSequencerDialect.cpp
@@ -280,14 +280,12 @@
target.addDynamicallyLegalOp<FuncOp>([&](FuncOp op) {
return typeConverter.isSignatureLegal(op.getType());
});
+ target.addLegalOp<ModuleOp, ModuleTerminatorOp,
+ IREE::MultiArchExecutableOp>();
+ target.markOpRecursivelyLegal<IREE::MultiArchExecutableOp>();
- // TODO(b/142791494): The conversion framework will recurse into the
- // executable if we just call it on the top-level module. This can't be a
- // function pass because type conversion replaces the original functions.
- auto funcsIt = getModule().getOps<FuncOp>();
- SmallVector<Operation *, 4> funcs(funcsIt.begin(), funcsIt.end());
-
- if (failed(applyFullConversion(funcs, target, patterns, &typeConverter))) {
+ if (failed(applyFullConversion(getModule(), target, patterns,
+ &typeConverter))) {
return signalPassFailure();
}
}