aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Niu <jeff@modular.com>2022-09-29 13:45:44 -0700
committerJeff Niu <jeff@modular.com>2022-09-29 15:58:37 -0700
commit5e82120e6815bb7aa2af095f056b0c18bfd314d7 (patch)
treec1fad014893ad3a645fbca8542a54fc7ff868771
parent3840e960bafc175c830963f8250d90339fac0d16 (diff)
downloadllvm-project-5e82120e6815bb7aa2af095f056b0c18bfd314d7.tar.gz
[mlir] Use `interleave` in `printOperands` (NFC)
Instead of reimplementing it. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D134904
-rw-r--r--mlir/include/mlir/IR/OpImplementation.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index fcfd2f57cf91..78843accdf45 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 <typename IteratorType>
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.