MLIR
23.0.0git
include
mlir
Transforms
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
18
namespace
mlir
{
19
20
class
DominanceInfo
;
21
class
Operation
;
22
class
Region
;
23
class
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.
31
void
eliminateCommonSubExpressions
(
RewriterBase
&rewriter,
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.
42
void
eliminateCommonSubExpressions
(
RewriterBase
&rewriter,
43
DominanceInfo
&domInfo,
Region
®ion,
44
bool
*changed =
nullptr
);
45
46
}
// namespace mlir
47
48
#endif
// MLIR_TRANSFORMS_CSE_H_
mlir::DominanceInfo
A class for computing basic dominance information.
Definition
Dominance.h:140
mlir::Operation
Operation is the basic unit of execution within MLIR.
Definition
Operation.h:88
mlir::Region
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Definition
Region.h:26
mlir::RewriterBase
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
Definition
PatternMatch.h:368
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
mlir::eliminateCommonSubExpressions
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
Generated on
for MLIR by
1.14.0