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

Maksim Levental llvmlistbot at llvm.org
Tue Nov 12 07:26: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:

sorry i didn't notice - you can just do here (and below)
```suggestion
          [](MlirValue self, MlirValue with, MlirOperation exception) {
```

all of this magic over here in [PybindAdaptors.h](https://github.com/llvm/llvm-project/blob/825d9f6e0cea21c50a767e80be5ba80479d65f0e/mlir/include/mlir/Bindings/Python/PybindAdaptors.h#L66-L202) will take care of it for you.

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


More information about the Mlir-commits mailing list