From 6b58c89914c737c40c4066249b8a0de37309f6bd Mon Sep 17 00:00:00 2001 From: Max191 <44243577+Max191@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:51:06 -0400 Subject: [PATCH] Remove variable used for only assertion (#3837) Removes a boolean variable that is used only for an assertion, and inlines the condition into the assertion. Signed-off-by: Max Dawkins --- lib/Dialect/Torch/IR/TorchOps.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Dialect/Torch/IR/TorchOps.cpp b/lib/Dialect/Torch/IR/TorchOps.cpp index 97b724984..84fa405f9 100644 --- a/lib/Dialect/Torch/IR/TorchOps.cpp +++ b/lib/Dialect/Torch/IR/TorchOps.cpp @@ -4001,10 +4001,9 @@ OpFoldResult AtenSliceTensorOp::fold(FoldAdaptor adaptor) { limit = limit < 0 ? limit + inType.getSizes()[dimInt] : limit; limit = limit < 0 ? -1 : limit; limit = std::min(limit, inType.getSizes()[dimInt]); - bool validIterArgs = - (stride > 0 && begin < limit) || (stride < 0 && begin > limit); - assert(validIterArgs && - "aten.slice.Tensor iteration args are statically invalid."); + assert((stride > 0 && begin < limit) || + (stride < 0 && begin > limit) && + "aten.slice.Tensor iteration args are statically invalid."); int64_t inputRank = inType.getSizes().size(); llvm::SmallVector inputStrides(inputRank, 1);