[Mlir-commits] [mlir] [mlir, python] Expose replaceAllUsesExcept to Python bindings (PR #115850)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Nov 12 09:49:46 PST 2024
================
@@ -956,6 +956,22 @@ MLIR_CAPI_EXPORTED MlirOpOperand mlirValueGetFirstUse(MlirValue value);
MLIR_CAPI_EXPORTED void mlirValueReplaceAllUsesOfWith(MlirValue of,
MlirValue with);
+/// Replace all uses of 'of' value with 'with' value, updating anything in the
+/// IR that uses 'of' to use 'with' instead, except if the user is listed in
+/// 'exceptions'. The 'exceptions' parameter is an array of MlirOperation
+/// pointers with a length of 'numExceptions'.
+MLIR_CAPI_EXPORTED void
+mlirValueReplaceAllUsesExceptWithSet(MlirValue of, MlirValue with,
+ MlirOperation *exceptions,
+ intptr_t numExceptions);
+
+/// Replace all uses of 'of' value with 'with' value, updating anything in the
+/// IR that uses 'of' to use 'with' instead, except if the user is
+/// 'exceptedUser'.
+MLIR_CAPI_EXPORTED void
+mlirValueReplaceAllUsesExceptWithSingle(MlirValue of, MlirValue with,
+ MlirOperation exceptedUser);
----------------
ftynse wrote:
Is this "overload" worth it? Specifically, the user would type `mlirValueReplaceAllUsesExceptWithSingle(of, with, user)` instead of `mlirValueReplaceAllUsesExceptWith(of, with, /*numExceptions=*/1, &user)` (dropping `Set` because it would be absent in that case). A couple of keystrokes...
https://github.com/llvm/llvm-project/pull/115850
More information about the Mlir-commits
mailing list