[Mlir-commits] [mlir] [mlir][IR] Tweak `RewriterBase::replaceUsesWithIf` call (PR #172883)
Tim Gymnich
llvmlistbot at llvm.org
Fri Dec 19 00:53:18 PST 2025
================
@@ -276,15 +276,16 @@ void RewriterBase::replaceUsesWithIf(ValueRange from, ValueRange to,
function_ref<bool(OpOperand &)> functor,
bool *allUsesReplaced) {
assert(from.size() == to.size() && "incorrect number of replacements");
- bool allReplaced = true;
- for (auto it : llvm::zip_equal(from, to)) {
- bool r;
- replaceUsesWithIf(std::get<0>(it), std::get<1>(it), functor,
- /*allUsesReplaced=*/&r);
- allReplaced &= r;
+ for (auto [fromVal, toVal] : llvm::zip_equal(from, to)) {
+ if (allUsesReplaced) {
+ bool r;
+ replaceUsesWithIf(fromVal, toVal, functor,
+ /*allUsesReplaced=*/&r);
+ *allUsesReplaced &= r;
----------------
tgymnich wrote:
I don't think we can assume that `allUsesReplaced` is initialized here.
https://github.com/llvm/llvm-project/pull/172883
More information about the Mlir-commits
mailing list