|
12 | 12 | #include "gc/Dialect/CPURuntime/IR/CPURuntimeDialect.h"
|
13 | 13 | #include "gc/Dialect/CPURuntime/IR/CPURuntimeOps.h"
|
14 | 14 | #include "gc/Transforms/Passes.h"
|
15 |
| -#include "mlir/Dialect/Affine/IR/AffineOps.h" |
16 | 15 | #include "mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h"
|
17 | 16 | #include "mlir/Dialect/Func/IR/FuncOps.h"
|
18 |
| -#include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
19 |
| -#include "mlir/Dialect/MemRef/IR/MemRef.h" |
20 |
| -#include "mlir/Dialect/SCF/IR/SCF.h" |
21 |
| -#include "mlir/IR/BuiltinDialect.h" |
22 | 17 | #include "mlir/IR/PatternMatch.h"
|
23 | 18 | #include "mlir/Rewrite/FrozenRewritePatternSet.h"
|
24 | 19 | #include "mlir/Support/LogicalResult.h"
|
@@ -107,23 +102,14 @@ struct ConvertMemRefToCPURuntime
|
107 | 102 |
|
108 | 103 | // add lowering target
|
109 | 104 | ConversionTarget target(getContext());
|
| 105 | + // Make all operations legal by default. |
| 106 | + target.markUnknownOpDynamicallyLegal([](Operation *op) { return true; }); |
110 | 107 | target.addDynamicallyLegalOp<memref::AllocOp, memref::DeallocOp>(
|
111 | 108 | [&](Operation *op) {
|
112 | 109 | // Return true if the operation is in the noTransformOps set, making
|
113 | 110 | // it dynamically legal.
|
114 | 111 | return noTransformOps.find(op) != noTransformOps.end();
|
115 | 112 | });
|
116 |
| - target.addLegalDialect< |
117 |
| - // clang-format off |
118 |
| - BuiltinDialect, |
119 |
| - func::FuncDialect, |
120 |
| - memref::MemRefDialect, |
121 |
| - cpuruntime::CPURuntimeDialect, |
122 |
| - arith::ArithDialect, |
123 |
| - affine::AffineDialect, |
124 |
| - scf::SCFDialect |
125 |
| - // clang-format on |
126 |
| - >(); |
127 | 113 | // set pattern
|
128 | 114 | RewritePatternSet patterns(ctx);
|
129 | 115 | patterns.add<AlignedAllocLowering>(ctx);
|
|
0 commit comments