Skip to content

Commit 6b58c89

Browse files
authored
Remove variable used for only assertion (llvm#3837)
Removes a boolean variable that is used only for an assertion, and inlines the condition into the assertion. Signed-off-by: Max Dawkins <[email protected]>
1 parent 16b3bd6 commit 6b58c89

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/Dialect/Torch/IR/TorchOps.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4001,10 +4001,9 @@ OpFoldResult AtenSliceTensorOp::fold(FoldAdaptor adaptor) {
40014001
limit = limit < 0 ? limit + inType.getSizes()[dimInt] : limit;
40024002
limit = limit < 0 ? -1 : limit;
40034003
limit = std::min(limit, inType.getSizes()[dimInt]);
4004-
bool validIterArgs =
4005-
(stride > 0 && begin < limit) || (stride < 0 && begin > limit);
4006-
assert(validIterArgs &&
4007-
"aten.slice.Tensor iteration args are statically invalid.");
4004+
assert((stride > 0 && begin < limit) ||
4005+
(stride < 0 && begin > limit) &&
4006+
"aten.slice.Tensor iteration args are statically invalid.");
40084007

40094008
int64_t inputRank = inType.getSizes().size();
40104009
llvm::SmallVector<int64_t> inputStrides(inputRank, 1);

0 commit comments

Comments
 (0)