Skip to content

Commit 7d99581

Browse files
committed
address review comment
1 parent 5020e49 commit 7d99581

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

mlir/include/mlir/Interfaces/LoopLikeInterface.td

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,29 +234,33 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
234234
/// If there is a single induction variable return it, otherwise return
235235
/// std::nullopt.
236236
::std::optional<::mlir::Value> getSingleInductionVar() {
237-
if (this->getInductionVars().size() == 1)
238-
return this->getInductionVars()[0];
237+
auto inductionVars = this->getInductionVars();
238+
if (inductionVars.size() == 1)
239+
return inductionVars[0];
239240
return std::nullopt;
240241
}
241242
/// Return the single lower bound value or attribute if it exists, otherwise
242243
/// return std::nullopt.
243244
::std::optional<::mlir::OpFoldResult> getSingleLowerBound() {
244-
if (this->getMixedLowerBound().size() == 1)
245-
return this->getMixedLowerBound()[0];
245+
auto lowerBounds = this->getMixedLowerBound();
246+
if (lowerBounds.size() == 1)
247+
return lowerBounds[0];
246248
return std::nullopt;
247249
}
248250
/// Return the single step value or attribute if it exists, otherwise
249251
/// return std::nullopt.
250252
::std::optional<::mlir::OpFoldResult> getSingleStep() {
251-
if (this->getMixedStep().size() == 1)
252-
return this->getMixedStep()[0];
253+
auto steps = this->getMixedStep();
254+
if (steps.size() == 1)
255+
return steps[0];
253256
return std::nullopt;
254257
}
255258
/// Return the single upper bound value or attribute if it exists, otherwise
256259
/// return std::nullopt.
257260
::std::optional<::mlir::OpFoldResult> getSingleUpperBound() {
258-
if (this->getMixedUpperBound().size() == 1)
259-
return this->getMixedUpperBound()[0];
261+
auto upperBounds = this->getMixedUpperBound();
262+
if (upperBounds.size() == 1)
263+
return upperBounds[0];
260264
return std::nullopt;
261265
}
262266

0 commit comments

Comments
 (0)