From 5e82120e6815bb7aa2af095f056b0c18bfd314d7 Mon Sep 17 00:00:00 2001 From: Jeff Niu Date: Thu, 29 Sep 2022 13:45:44 -0700 Subject: [PATCH] [mlir] Use `interleave` in `printOperands` (NFC) Instead of reimplementing it. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D134904 --- mlir/include/mlir/IR/OpImplementation.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h index fcfd2f5..78843ac 100644 --- a/mlir/include/mlir/IR/OpImplementation.h +++ b/mlir/include/mlir/IR/OpImplementation.h @@ -356,13 +356,8 @@ public: /// Print a comma separated list of operands. template void printOperands(IteratorType it, IteratorType end) { - if (it == end) - return; - printOperand(*it); - for (++it; it != end; ++it) { - getStream() << ", "; - printOperand(*it); - } + llvm::interleaveComma(llvm::make_range(it, end), getStream(), + [this](Value value) { printOperand(value); }); } /// Print the given successor. -- 2.7.4