Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir][Transforms][NFC] CSE: Add non-pass entry point
Add an additional entry point so that CSE can be used without a pass. This allows CSE to be used from the Transform dialect without invalidating all handles. * All IR modifications are done with a rewriter. * The C++ entry point takes a `RewriterBase &`, which may have a listener attached to it. This allows users to track all IR modifications. Differential Revision: https://reviews.llvm.org/D145226
- Loading branch information
1 parent
92b5a34
commit 189033e
Showing
3 changed files
with
134 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//===- CSE.h - Common Subexpression Elimination -----------------*- C++ -*-===// | ||
// | ||
// 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 declares methods for eliminating common subexpressions. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_TRANSFORMS_CSE_H_ | ||
#define MLIR_TRANSFORMS_CSE_H_ | ||
|
||
namespace mlir { | ||
|
||
class DominanceInfo; | ||
class Operation; | ||
class RewriterBase; | ||
|
||
/// Eliminate common subexpressions within the given operation. This transform | ||
/// looks for and deduplicates equivalent operations. | ||
/// | ||
/// `changed` indicates whether the IR was modified or not. | ||
void eliminateCommonSubExpressions(RewriterBase &rewriter, | ||
DominanceInfo &domInfo, Operation *op, | ||
bool *changed = nullptr); | ||
|
||
} // namespace mlir | ||
|
||
#endif // MLIR_TRANSFORMS_CSE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters