Skip to content

Commit 466a8f0

Browse files
committed
Address comments
1 parent a1da90b commit 466a8f0

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

mlir/include/mlir/IR/PatternMatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
#include "mlir/IR/Builders.h"
1313
#include "mlir/IR/BuiltinOps.h"
14+
#include "mlir/IR/PatternMatchAction.h"
1415
#include "llvm/ADT/FunctionExtras.h"
1516
#include "llvm/Support/TypeName.h"
16-
#include <mlir/IR/PatternMatchAction.h>
1717
#include <optional>
1818

1919
using llvm::SmallPtrSetImpl;
@@ -655,7 +655,7 @@ class RewriterBase : public OpBuilder {
655655
void replaceAllUsesWith(Value from, Value to) {
656656
if (auto *fromOp = from.getDefiningOp())
657657
getContext()->executeAction<ReplaceOpAction>(
658-
[]() {}, ArrayRef<IRUnit>{fromOp}, to);
658+
/*actionFn=*/[]() {}, ArrayRef<IRUnit>{fromOp}, to);
659659
for (OpOperand &operand : llvm::make_early_inc_range(from.getUses())) {
660660
Operation *op = operand.getOwner();
661661
modifyOpInPlace(op, [&]() { operand.set(to); });

mlir/lib/IR/PatternMatch.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,15 @@ ReplaceOpAction::ReplaceOpAction(ArrayRef<IRUnit> irUnits,
137137

138138
void ReplaceOpAction::print(raw_ostream &os) const {
139139
OpPrintingFlags flags;
140-
flags.elideLargeElementsAttrs(10);
140+
flags.elideLargeElementsAttrs();
141141
os << "`" << tag << "` replacing operation `";
142142
getOp()->print(os, flags);
143143
os << "` by ";
144-
bool first = true;
145-
for (auto r : replacement) {
146-
if (!first)
147-
os << ", ";
144+
llvm::interleaveComma(replacement, os, [&](Value r) {
148145
os << "`";
149146
r.print(os, flags);
150147
os << "`";
151-
first = false;
152-
}
148+
});
153149
}
154150

155151
Operation *ReplaceOpAction::getOp() const {
@@ -297,7 +293,7 @@ void RewriterBase::replaceUsesWithIf(Value from, Value to,
297293
if (replace) {
298294
if (auto *fromOp = from.getDefiningOp())
299295
getContext()->executeAction<ReplaceOpAction>(
300-
[]() {}, ArrayRef<IRUnit>{fromOp}, to);
296+
/*actionFn=*/[]() {}, ArrayRef<IRUnit>{fromOp}, to);
301297
modifyOpInPlace(operand.getOwner(), [&]() { operand.set(to); });
302298
}
303299
allReplaced &= replace;

0 commit comments

Comments
 (0)