2222#include " mlir/include/mlir/Dialect/Affine/IR/AffineOps.h" // from @llvm-project
2323#include " mlir/include/mlir/Dialect/Arith/IR/Arith.h" // from @llvm-project
2424#include " mlir/include/mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project
25+ #include " mlir/include/mlir/Dialect/SCF/IR/SCF.h" // from @llvm-project
2526#include " mlir/include/mlir/Dialect/Tensor/IR/Tensor.h" // from @llvm-project
2627#include " mlir/include/mlir/Dialect/Utils/StaticValueUtils.h" // from @llvm-project
2728#include " mlir/include/mlir/IR/Attributes.h" // from @llvm-project
@@ -516,15 +517,12 @@ void addSecretToSchemeDefaultConversionTargetsAndPatterns(
516517 ContextAwareTypeConverter& typeConverter) {
517518 target.addLegalDialect <lwe::LWEDialect, arith::ArithDialect,
518519 tensor::TensorDialect>();
519- target.addLegalOp <ModuleOp>();
520-
521520 target.addIllegalDialect <secret::SecretDialect>();
522- target.addIllegalOp <mgmt::ModReduceOp, mgmt::RelinearizeOp,
523- secret::GenericOp>();
521+ target.addIllegalOp <mgmt::ModReduceOp, mgmt::RelinearizeOp>();
524522
525- target.addDynamicallyLegalOp <affine::AffineForOp, affine::AffineYieldOp>(
526- [&](Operation* op) { return typeConverter. isLegal (op); });
527- target. addDynamicallyLegalOp < func::CallOp>(
523+ target.addDynamicallyLegalOp <affine::AffineForOp, affine::AffineYieldOp,
524+ affine::AffineIfOp, scf::ForOp, scf::IfOp,
525+ scf::YieldOp, func::CallOp>(
528526 [&](Operation* op) { return typeConverter.isLegal (op); });
529527 target.markUnknownOpDynamicallyLegal (
530528 [&](Operation* op) { return !hasSecretOperandsOrResults (op); });
@@ -538,7 +536,11 @@ void addSecretToSchemeDefaultConversionTargetsAndPatterns(
538536 SecretGenericOpConversion<tensor::EmptyOp, tensor::EmptyOp>,
539537 SecretGenericFuncCallConversion, ConvertExtractSlice,
540538 ConvertInsertSlice, ConvertAnyContextAware<affine::AffineForOp>,
539+ ConvertAnyContextAware<affine::AffineIfOp>,
541540 ConvertAnyContextAware<affine::AffineYieldOp>,
541+ ConvertAnyContextAware<scf::ForOp>,
542+ ConvertAnyContextAware<scf::IfOp>,
543+ ConvertAnyContextAware<scf::YieldOp>,
542544 ConvertAnyContextAware<tensor::ExtractOp>,
543545 ConvertAnyContextAware<tensor::InsertOp>,
544546 ConvertAnyContextAware<func::CallOp>>(typeConverter,
0 commit comments