MLIR 23.0.0git
CSE.h
Go to the documentation of this file.
1//===- CSE.h - Common Subexpression Elimination -----------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares methods for eliminating common subexpressions.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_TRANSFORMS_CSE_H_
14#define MLIR_TRANSFORMS_CSE_H_
15
16#include <cstdint>
17
18namespace mlir {
19
20class DominanceInfo;
21class Operation;
22class Region;
23class RewriterBase;
24
25/// Eliminate common subexpressions within the given operation. This transform
26/// looks for and deduplicates equivalent operations.
27///
28/// `changed` indicates whether the IR was modified or not. `numCSE` and
29/// `numDCE` receive counts of operations deduplicated and dead operations
30/// erased, respectively.
32 DominanceInfo &domInfo, Operation *op,
33 bool *changed = nullptr,
34 int64_t *numCSE = nullptr,
35 int64_t *numDCE = nullptr);
36
37/// Eliminate common subexpressions within the given region.
38///
39/// `changed` indicates whether the IR was modified or not. Statistics are not
40/// reported through this overload; use the `Operation *` overload when CSE /
41/// DCE counts are needed.
43 DominanceInfo &domInfo, Region &region,
44 bool *changed = nullptr);
45
46} // namespace mlir
47
48#endif // MLIR_TRANSFORMS_CSE_H_
A class for computing basic dominance information.
Definition Dominance.h:140
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Definition Region.h:26
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
Include the generated interface declarations.
void eliminateCommonSubExpressions(RewriterBase &rewriter, DominanceInfo &domInfo, Operation *op, bool *changed=nullptr, int64_t *numCSE=nullptr, int64_t *numDCE=nullptr)
Eliminate common subexpressions within the given operation.
Definition CSE.cpp:418