From 0ddba0bd59c337f16b51a00cb205ecfda46f97fa Mon Sep 17 00:00:00 2001 From: River Riddle Date: Thu, 12 Mar 2020 14:06:41 -0700 Subject: [mlir][SideEffects] Replace HasNoSideEffect with the memory effect interfaces. HasNoSideEffect can now be implemented using the MemoryEffectInterface, removing the need to check multiple things for the same information. This also removes an easy foot-gun for users as 'Operation::hasNoSideEffect' would ignore operations that dynamically, or recursively, have no side effects. This also leads to an immediate improvement in some of the existing users, such as DCE, now that they have access to more information. Differential Revision: https://reviews.llvm.org/D76036 --- mlir/lib/Transforms/Utils/FoldUtils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mlir/lib/Transforms/Utils/FoldUtils.cpp') diff --git a/mlir/lib/Transforms/Utils/FoldUtils.cpp b/mlir/lib/Transforms/Utils/FoldUtils.cpp index f374d38..66535ec 100644 --- a/mlir/lib/Transforms/Utils/FoldUtils.cpp +++ b/mlir/lib/Transforms/Utils/FoldUtils.cpp @@ -126,6 +126,12 @@ void OperationFolder::notifyRemoval(Operation *op) { referencedDialects.erase(it); } +/// Clear out any constants cached inside of the folder. +void OperationFolder::clear() { + foldScopes.clear(); + referencedDialects.clear(); +} + /// Tries to perform folding on the given `op`. If successful, populates /// `results` with the results of the folding. LogicalResult OperationFolder::tryToFold( -- cgit v1.1