[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Add support for `replaceUsesWithIf` (PR #169606)
Markus Böck
llvmlistbot at llvm.org
Wed Nov 26 02:27:11 PST 2025
================
@@ -1238,7 +1246,11 @@ static void performReplaceValue(RewriterBase &rewriter, Value from,
Block *replBlock = replOp->getBlock();
rewriter.replaceUsesWithIf(from, repl, [&](OpOperand &operand) {
Operation *user = operand.getOwner();
- return user->getBlock() != replBlock || replOp->isBeforeInBlock(user);
+ bool result =
+ user->getBlock() != replBlock || replOp->isBeforeInBlock(user);
+ if (functor)
+ result &= functor(operand);
----------------
zero9178 wrote:
```suggestion
if (result && functor)
result &= functor(operand);
```
Not sure it makes a huge difference, but could short circuit here by not calling `functor` if `result` is already false
https://github.com/llvm/llvm-project/pull/169606
More information about the Mlir-commits
mailing list