diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h --- a/mlir/include/mlir/IR/PatternMatch.h +++ b/mlir/include/mlir/IR/PatternMatch.h @@ -480,9 +480,10 @@ /// Replaces the result op with a new op that is created without verification. /// The result values of the two ops must be the same types. template - void replaceOpWithNewOp(Operation *op, Args &&... args) { + OpTy replaceOpWithNewOp(Operation *op, Args &&... args) { auto newOp = create(op->getLoc(), std::forward(args)...); replaceOpWithResultsOfAnotherOp(op, newOp.getOperation()); + return newOp; } /// This method erases an operation that is known to have no uses.