mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-23 01:20:03 +00:00
[MLIR][Linalg] Avoid forward declaration in Loops.cpp
Differential Revision: https://reviews.llvm.org/D101771
This commit is contained in:
parent
ec339163a7
commit
456efbc0f1
@ -590,22 +590,6 @@ struct TiledLoopToSCFPattern : public OpRewritePattern<TiledLoopOp> {
|
||||
}
|
||||
};
|
||||
|
||||
struct FoldAffineOp;
|
||||
} // namespace
|
||||
|
||||
template <typename LoopType>
|
||||
static void lowerLinalgToLoopsImpl(FuncOp funcOp) {
|
||||
MLIRContext *context = funcOp.getContext();
|
||||
RewritePatternSet patterns(context);
|
||||
patterns.add<LinalgRewritePattern<LoopType>>(context);
|
||||
memref::DimOp::getCanonicalizationPatterns(patterns, context);
|
||||
AffineApplyOp::getCanonicalizationPatterns(patterns, context);
|
||||
patterns.add<FoldAffineOp>(context);
|
||||
// Just apply the patterns greedily.
|
||||
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
|
||||
}
|
||||
|
||||
namespace {
|
||||
/// Local folding pattern for AffineApplyOp that we can apply greedily.
|
||||
/// This replaces AffineApplyOp by the proper value in cases where the
|
||||
/// associated map is trivial.
|
||||
@ -643,6 +627,18 @@ struct FoldAffineOp : public RewritePattern {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename LoopType>
|
||||
static void lowerLinalgToLoopsImpl(FuncOp funcOp) {
|
||||
MLIRContext *context = funcOp.getContext();
|
||||
RewritePatternSet patterns(context);
|
||||
patterns.add<LinalgRewritePattern<LoopType>>(context);
|
||||
memref::DimOp::getCanonicalizationPatterns(patterns, context);
|
||||
AffineApplyOp::getCanonicalizationPatterns(patterns, context);
|
||||
patterns.add<FoldAffineOp>(context);
|
||||
// Just apply the patterns greedily.
|
||||
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
|
||||
}
|
||||
|
||||
struct LowerToAffineLoops
|
||||
: public LinalgLowerToAffineLoopsBase<LowerToAffineLoops> {
|
||||
void getDependentDialects(DialectRegistry ®istry) const override {
|
||||
|
Loading…
x
Reference in New Issue
Block a user