#include "mlir/Transforms/CSE.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/ScopedHashTable.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/RecyclingAllocator.h"
#include <deque>
namespace mlir {
#define GEN_PASS_DEF_CSE
#include "mlir/Transforms/Passes.h.inc"
}
usingnamespacemlir;
namespace {
struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> { … };
}
namespace {
class CSEDriver { … };
}
void CSEDriver::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
Operation *existing,
bool hasSSADominance) { … }
bool CSEDriver::hasOtherSideEffectingOpInBetween(Operation *fromOp,
Operation *toOp) { … }
LogicalResult CSEDriver::simplifyOperation(ScopedMapTy &knownValues,
Operation *op,
bool hasSSADominance) { … }
void CSEDriver::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
bool hasSSADominance) { … }
void CSEDriver::simplifyRegion(ScopedMapTy &knownValues, Region ®ion) { … }
void CSEDriver::simplify(Operation *op, bool *changed) { … }
void mlir::eliminateCommonSubExpressions(RewriterBase &rewriter,
DominanceInfo &domInfo, Operation *op,
bool *changed) { … }
namespace {
struct CSE : public impl::CSEBase<CSE> { … };
}
void CSE::runOnOperation() { … }
std::unique_ptr<Pass> mlir::createCSEPass() { … }