Skip to content

Commit abf8303

Browse files
committed
Remove extraneous overloads
1 parent d9c3cd7 commit abf8303

File tree

3 files changed

+11
-29
lines changed

3 files changed

+11
-29
lines changed

mlir/include/mlir-c/IR.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -961,16 +961,9 @@ MLIR_CAPI_EXPORTED void mlirValueReplaceAllUsesOfWith(MlirValue of,
961961
/// 'exceptions'. The 'exceptions' parameter is an array of MlirOperation
962962
/// pointers with a length of 'numExceptions'.
963963
MLIR_CAPI_EXPORTED void
964-
mlirValueReplaceAllUsesExceptWithSet(MlirValue of, MlirValue with,
965-
MlirOperation *exceptions,
966-
intptr_t numExceptions);
967-
968-
/// Replace all uses of 'of' value with 'with' value, updating anything in the
969-
/// IR that uses 'of' to use 'with' instead, except if the user is
970-
/// 'exceptedUser'.
971-
MLIR_CAPI_EXPORTED void
972-
mlirValueReplaceAllUsesExceptWithSingle(MlirValue of, MlirValue with,
973-
MlirOperation exceptedUser);
964+
mlirValueReplaceAllUsesExcept(MlirValue of, MlirValue with,
965+
intptr_t numExceptions,
966+
MlirOperation *exceptions);
974967

975968
//===----------------------------------------------------------------------===//
976969
// OpOperand API.

mlir/lib/Bindings/Python/IRCore.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,22 +3728,22 @@ void mlir::python::populateIRCore(py::module &m) {
37283728
"replace_all_uses_except",
37293729
[](MlirValue self, MlirValue with, PyOperation &exception) {
37303730
MlirOperation exceptedUser = exception.get();
3731-
mlirValueReplaceAllUsesExceptWithSingle(self, with, exceptedUser);
3731+
mlirValueReplaceAllUsesExcept(self, with, 1, &exceptedUser);
37323732
},
37333733
py::arg("with"), py::arg("exceptions"),
37343734
kValueReplaceAllUsesExceptDocstring)
37353735
.def(
37363736
"replace_all_uses_except",
37373737
[](MlirValue self, MlirValue with, py::list exceptions) {
37383738
// Convert Python list to a SmallVector of MlirOperations
3739-
llvm::SmallVector<MlirOperation, 4> exceptionOps;
3739+
llvm::SmallVector<MlirOperation> exceptionOps;
37403740
for (py::handle exception : exceptions) {
37413741
exceptionOps.push_back(exception.cast<PyOperation &>().get());
37423742
}
37433743

3744-
mlirValueReplaceAllUsesExceptWithSet(
3745-
self, with, exceptionOps.data(),
3746-
static_cast<intptr_t>(exceptionOps.size()));
3744+
mlirValueReplaceAllUsesExcept(
3745+
self, with, static_cast<intptr_t>(exceptionOps.size()),
3746+
exceptionOps.data());
37473747
},
37483748
py::arg("with"), py::arg("exceptions"),
37493749
kValueReplaceAllUsesExceptDocstring)

mlir/lib/CAPI/IR/IR.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,9 @@ void mlirValueReplaceAllUsesOfWith(MlirValue oldValue, MlirValue newValue) {
10101010
unwrap(oldValue).replaceAllUsesWith(unwrap(newValue));
10111011
}
10121012

1013-
void mlirValueReplaceAllUsesExceptWithSet(MlirValue oldValue,
1014-
MlirValue newValue,
1015-
MlirOperation *exceptions,
1016-
intptr_t numExceptions) {
1013+
void mlirValueReplaceAllUsesExcept(MlirValue oldValue, MlirValue newValue,
1014+
intptr_t numExceptions,
1015+
MlirOperation *exceptions) {
10171016
Value oldValueCpp = unwrap(oldValue);
10181017
Value newValueCpp = unwrap(newValue);
10191018

@@ -1025,16 +1024,6 @@ void mlirValueReplaceAllUsesExceptWithSet(MlirValue oldValue,
10251024
oldValueCpp.replaceAllUsesExcept(newValueCpp, exceptionSet);
10261025
}
10271026

1028-
void mlirValueReplaceAllUsesExceptWithSingle(MlirValue oldValue,
1029-
MlirValue newValue,
1030-
MlirOperation exceptedUser) {
1031-
Value oldValueCpp = unwrap(oldValue);
1032-
Value newValueCpp = unwrap(newValue);
1033-
Operation *exceptedUserCpp = unwrap(exceptedUser);
1034-
1035-
oldValueCpp.replaceAllUsesExcept(newValueCpp, exceptedUserCpp);
1036-
}
1037-
10381027
//===----------------------------------------------------------------------===//
10391028
// OpOperand API.
10401029
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)