@@ -5510,6 +5510,10 @@ struct MulDivMul : public OpRewritePattern<arith::MulIOp> {
5510
5510
}
5511
5511
};
5512
5512
5513
+ static llvm::cl::opt<bool >
5514
+ BufferElim (" enable-buffer-elim" , llvm::cl::init(true ),
5515
+ llvm::cl::desc(" Enable buffer elimination" ));
5516
+
5513
5517
void TypeAlignOp::getCanonicalizationPatterns (RewritePatternSet &results,
5514
5518
MLIRContext *context) {
5515
5519
results.insert <
@@ -5520,15 +5524,21 @@ void TypeAlignOp::getCanonicalizationPatterns(RewritePatternSet &results,
5520
5524
AlwaysAllocaScopeHoister<AffineForOp>, ConstantRankReduction,
5521
5525
AffineIfSinking, AffineIfSimplification, CombineAffineIfs,
5522
5526
MergeNestedAffineParallelLoops, PrepMergeNestedAffineParallelLoops,
5523
- MergeNestedAffineParallelIf, RemoveAffineParallelSingleIter,
5524
- BufferElimination<memref::AllocaOp>, BufferElimination<memref::AllocOp>,
5525
- AffineBufferElimination<memref::AllocaOp>,
5526
- AffineBufferElimination<memref::AllocOp>,
5527
- SimplifyDeadAllocV2<memref::AllocaOp>,
5528
- SimplifyDeadAllocV2<memref::AllocOp>, SimplifyDeadAllocV2<LLVM::AllocaOp>,
5529
- MulDivMul, MergeParallelInductions,
5530
- // RankReduction<memref::AllocaOp, scf::ParallelOp>,
5531
- AggressiveAllocaScopeInliner, InductiveVarRemoval>(context);
5527
+ MergeNestedAffineParallelIf, RemoveAffineParallelSingleIter>(context);
5528
+
5529
+ if (BufferElim) {
5530
+ results.insert <BufferElimination<memref::AllocaOp>,
5531
+ BufferElimination<memref::AllocOp>,
5532
+ AffineBufferElimination<memref::AllocaOp>,
5533
+ AffineBufferElimination<memref::AllocOp>>(context);
5534
+ }
5535
+
5536
+ results.insert <SimplifyDeadAllocV2<memref::AllocaOp>,
5537
+ SimplifyDeadAllocV2<memref::AllocOp>,
5538
+ SimplifyDeadAllocV2<LLVM::AllocaOp>, MulDivMul,
5539
+ MergeParallelInductions,
5540
+ // RankReduction<memref::AllocaOp, scf::ParallelOp>,
5541
+ AggressiveAllocaScopeInliner, InductiveVarRemoval>(context);
5532
5542
}
5533
5543
5534
5544
// ===----------------------------------------------------------------------===//
0 commit comments