[Mlir-commits] [mlir] [mlir][SCF] Modernize `coalesceLoops` method to handle `scf.for` loops with iter_args (PR #87019)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri Mar 29 08:06:49 PDT 2024


================
@@ -697,6 +698,14 @@ class RewriterBase : public OpBuilder {
       return user != exceptedUser;
     });
   }
+  void
+  replaceAllUsesExcept(Value from, Value to,
+                       const SmallPtrSetImpl<Operation *> &preservedUsers) {
+    return replaceUsesWithIf(from, to, [&](OpOperand &use) {
+      Operation *user = use.getOwner();
+      return !preservedUsers.contains(user);
+    });
----------------
ftynse wrote:

Could this be moved to `.cpp` so we don't need to include the relatively rarely used `SmallPtrSet.h` into numerous files that (transitively) use pattern matching?

https://github.com/llvm/llvm-project/pull/87019


More information about the Mlir-commits mailing list