//===- SimplifyAffineStructures.cpp ---------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements a pass to simplify affine structures in operations. // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Affine/Analysis/Utils.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/Utils.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/IR/IntegerSet.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" namespace mlir { namespace affine { #define GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURES #include "mlir/Dialect/Affine/Passes.h.inc" } // namespace affine } // namespace mlir #define DEBUG_TYPE … usingnamespacemlir; usingnamespacemlir::affine; namespace { /// Simplifies affine maps and sets appearing in the operations of the Function. /// This part is mainly to test the simplifyAffineExpr method. In addition, /// all memrefs with non-trivial layout maps are converted to ones with trivial /// identity layout ones. struct SimplifyAffineStructures : public affine::impl::SimplifyAffineStructuresBase< SimplifyAffineStructures> { … }; } // namespace std::unique_ptr<OperationPass<func::FuncOp>> mlir::affine::createSimplifyAffineStructuresPass() { … } void SimplifyAffineStructures::runOnOperation() { … }