[Mlir-commits] [mlir] [mlir, python] Expose replaceAllUsesExcept to Python bindings (PR #115850)

Maksim Levental llvmlistbot at llvm.org
Tue Nov 12 07:49:01 PST 2024


================
@@ -3718,6 +3724,36 @@ void mlir::python::populateIRCore(py::module &m) {
             mlirValueReplaceAllUsesOfWith(self.get(), with.get());
           },
           kValueReplaceAllUsesWithDocstring)
+      .def(
+          "replace_all_uses_except",
+          [](PyValue &self, PyValue &with, PyOperation &exception) {
----------------
makslevental wrote:

I took a quick look in `IRCore.cpp` before making the suggestion it seems those uses are because the various fields/methods of those classes are in fact exercised. Here, where you're just immediately calling the C API, you don't need any of that functionality. I mean ultimately this is a nit - it's up to you - you can save a couple of lines but it makes no difference (the magic in `PybindAdaptors.h` does exactly what you're doing here - `.get()`).

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


More information about the Mlir-commits mailing list