Skip to content

Commit 0692784

Browse files
committed
Apply clang-tidy fixes for performance-unnecessary-value-param in SliceAnalysis.cpp (NFC)
1 parent 2ee87cd commit 0692784

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

mlir/include/mlir/Analysis/SliceAnalysis.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ using ForwardSliceOptions = SliceOptions;
9393
/// {4, 3, 6, 2, 1, 5, 8, 7, 9}
9494
///
9595
void getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
96-
ForwardSliceOptions options = {});
96+
const ForwardSliceOptions &options = {});
9797

9898
/// Value-rooted version of `getForwardSlice`. Return the union of all forward
9999
/// slices for the uses of the value `root`.
100100
void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
101-
ForwardSliceOptions options = {});
101+
const ForwardSliceOptions &options = {});
102102

103103
/// Fills `backwardSlice` with the computed backward slice (i.e.
104104
/// all the transitive defs of op), **without** including that operation.
@@ -135,12 +135,12 @@ void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
135135
/// {1, 2, 5, 3, 4, 6}
136136
///
137137
void getBackwardSlice(Operation *op, SetVector<Operation *> *backwardSlice,
138-
BackwardSliceOptions options = {});
138+
const BackwardSliceOptions &options = {});
139139

140140
/// Value-rooted version of `getBackwardSlice`. Return the union of all backward
141141
/// slices for the op defining or owning the value `root`.
142142
void getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
143-
BackwardSliceOptions options = {});
143+
const BackwardSliceOptions &options = {});
144144

145145
/// Iteratively computes backward slices and forward slices until
146146
/// a fixed point is reached. Returns an `SetVector<Operation *>` which
@@ -219,9 +219,9 @@ void getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
219219
/// and keep things ordered but this is still hand-wavy and not worth the
220220
/// trouble for now: punt to a simple worklist-based solution.
221221
///
222-
SetVector<Operation *> getSlice(Operation *op,
223-
BackwardSliceOptions backwardSliceOptions = {},
224-
ForwardSliceOptions forwardSliceOptions = {});
222+
SetVector<Operation *>
223+
getSlice(Operation *op, const BackwardSliceOptions &backwardSliceOptions = {},
224+
const ForwardSliceOptions &forwardSliceOptions = {});
225225

226226
/// Multi-root DAG topological sort.
227227
/// Performs a topological sort of the Operation in the `toSort` SetVector.

mlir/lib/Analysis/SliceAnalysis.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace mlir;
2626

2727
static void
2828
getForwardSliceImpl(Operation *op, SetVector<Operation *> *forwardSlice,
29-
SliceOptions::TransitiveFilter filter = nullptr) {
29+
const SliceOptions::TransitiveFilter &filter = nullptr) {
3030
if (!op)
3131
return;
3232

@@ -51,7 +51,7 @@ getForwardSliceImpl(Operation *op, SetVector<Operation *> *forwardSlice,
5151
}
5252

5353
void mlir::getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
54-
ForwardSliceOptions options) {
54+
const ForwardSliceOptions &options) {
5555
getForwardSliceImpl(op, forwardSlice, options.filter);
5656
if (!options.inclusive) {
5757
// Don't insert the top level operation, we just queried on it and don't
@@ -67,7 +67,7 @@ void mlir::getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
6767
}
6868

6969
void mlir::getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
70-
SliceOptions options) {
70+
const SliceOptions &options) {
7171
for (Operation *user : root.getUsers())
7272
getForwardSliceImpl(user, forwardSlice, options.filter);
7373

@@ -80,7 +80,7 @@ void mlir::getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
8080

8181
static void getBackwardSliceImpl(Operation *op,
8282
SetVector<Operation *> *backwardSlice,
83-
BackwardSliceOptions options) {
83+
const BackwardSliceOptions &options) {
8484
if (!op || op->hasTrait<OpTrait::IsIsolatedFromAbove>())
8585
return;
8686

@@ -119,7 +119,7 @@ static void getBackwardSliceImpl(Operation *op,
119119

120120
void mlir::getBackwardSlice(Operation *op,
121121
SetVector<Operation *> *backwardSlice,
122-
BackwardSliceOptions options) {
122+
const BackwardSliceOptions &options) {
123123
getBackwardSliceImpl(op, backwardSlice, options);
124124

125125
if (!options.inclusive) {
@@ -130,7 +130,7 @@ void mlir::getBackwardSlice(Operation *op,
130130
}
131131

132132
void mlir::getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
133-
BackwardSliceOptions options) {
133+
const BackwardSliceOptions &options) {
134134
if (Operation *definingOp = root.getDefiningOp()) {
135135
getBackwardSlice(definingOp, backwardSlice, options);
136136
return;
@@ -139,9 +139,9 @@ void mlir::getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
139139
getBackwardSlice(bbAargOwner, backwardSlice, options);
140140
}
141141

142-
SetVector<Operation *> mlir::getSlice(Operation *op,
143-
BackwardSliceOptions backwardSliceOptions,
144-
ForwardSliceOptions forwardSliceOptions) {
142+
SetVector<Operation *>
143+
mlir::getSlice(Operation *op, const BackwardSliceOptions &backwardSliceOptions,
144+
const ForwardSliceOptions &forwardSliceOptions) {
145145
SetVector<Operation *> slice;
146146
slice.insert(op);
147147

0 commit comments

Comments
 (0)