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/Analysis/Utils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mlir/lib/Analysis/Utils.cpp') diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Analysis/Utils.cpp index 14635a1..7b3cd58 100644 --- a/mlir/lib/Analysis/Utils.cpp +++ b/mlir/lib/Analysis/Utils.cpp @@ -974,11 +974,12 @@ void mlir::getSequentialLoops(AffineForOp forOp, bool mlir::isLoopParallel(AffineForOp forOp) { // Collect all load and store ops in loop nest rooted at 'forOp'. SmallVector loadAndStoreOpInsts; - auto walkResult = forOp.walk([&](Operation *opInst) { + auto walkResult = forOp.walk([&](Operation *opInst) -> WalkResult { if (isa(opInst) || isa(opInst)) loadAndStoreOpInsts.push_back(opInst); else if (!isa(opInst) && !isa(opInst) && - !isa(opInst) && !opInst->hasNoSideEffect()) + !isa(opInst) && + !MemoryEffectOpInterface::hasNoEffect(opInst)) return WalkResult::interrupt(); return WalkResult::advance(); -- cgit v1.1