Skip to content

Commit 6114fcf

Browse files
committed
move assertion
1 parent 5c5396b commit 6114fcf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,11 +1223,11 @@ static Value bitcastSubByteVectorToI8(PatternRewriter &rewriter, Location loc,
12231223
static Value extractNBitsPerByteAndSignExtendToI8(PatternRewriter &rewriter,
12241224
Location loc, Value src,
12251225
int bitIdx, int numBits) {
1226-
assert(bitIdx >= 0 && bitIdx <= 8 - numBits && numBits > 0 && numBits <= 8 &&
1227-
"Invalid bitIdx range");
12281226
auto srcType = cast<VectorType>(src.getType());
12291227
Value shl = src;
12301228
int8_t bitsToShiftLeft = 8 - numBits - bitIdx;
1229+
assert(bitIdx >= 0 && bitsToShiftLeft >= 0 && numBits > 0 && numBits <= 8 &&
1230+
"Invalid bitIdx range");
12311231
if (bitsToShiftLeft != 0) {
12321232
Value shiftLeftValues = rewriter.create<arith::ConstantOp>(
12331233
loc, DenseElementsAttr::get(srcType, bitsToShiftLeft));

0 commit comments

Comments
 (0)