`ConversionPatternRewriter::replaceUsesWithIf` does not support the `allUsesReplaced` flag and asserts that it's not set. However the `ValueRange` overload of `RewriterBase::replaceUsesWithIf` always passes this flag when calling the virtual overload of `replaceUsesWithIf`. This means calls made to `RewriterBase::replaceUsesWithIf` from a `ConversionPattern` crash, whether the `allUsesReplaced` flag is set or not. This change tweaks `RewriterBase::replaceUsesWithIf` to only pass that flag if the callee has set it.
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.