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 C++ entry point
* All IR modifications are done with a rewriter. * The new C++ entry point takes a `RewriterBase &`, which may have a listener attached to it. This revision is useful because it allows users to run CSE and track IR modifications via a listener that can be attached to the rewriter. This is a reupload. The original CL was reverted (9979417) due to a memory leak. The memory leak is unrelated to this change and fixed with D154185. Differential Revision: https://reviews.llvm.org/D145226
- Loading branch information
1 parent
c487fe3
commit b9bdff4
Showing
3 changed files
with
128 additions
and
30 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