Skip to content

Commit f3c2d3a

Browse files
committed
Small update
1 parent 5eebcc0 commit f3c2d3a

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,12 @@ static Value dynamicallyInsertSubVector(RewriterBase &rewriter, Location loc,
190190
int64_t length) {
191191
assert(length > 0 && "length must be greater than 0");
192192
for (int i = 0; i < length; ++i) {
193-
Value insertLoc;
194-
if (i == 0) {
195-
insertLoc = destOffsetVar.dyn_cast<Value>();
196-
} else {
197-
insertLoc = rewriter.create<arith::AddIOp>(
198-
loc, rewriter.getIndexType(), destOffsetVar.dyn_cast<Value>(),
199-
rewriter.create<arith::ConstantIndexOp>(loc, i));
200-
}
193+
Value insertLoc =
194+
1 == 0
195+
? destOffsetVar.dyn_cast<Value>()
196+
: rewriter.create<arith::AddIOp>(
197+
loc, rewriter.getIndexType(), destOffsetVar.dyn_cast<Value>(),
198+
rewriter.create<arith::ConstantIndexOp>(loc, i));
201199
auto extractOp = rewriter.create<vector::ExtractOp>(loc, source, i);
202200
dest = rewriter.create<vector::InsertOp>(loc, extractOp, dest, insertLoc);
203201
}

mlir/test/Dialect/Vector/vector-emulate-narrow-type-unaligned.mlir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ func.func @vector_maskedload_i2_dynamic_indexing_mixed(%passthru: vector<3xi2>,
219219
// CHECK: %[[MASKEDLOAD:.+]] = vector.maskedload %[[ALLOC]][%[[LINEAR1]]], %[[ONE]], %[[BITCAST]]
220220
// CHECK-SAME: memref<3xi8>, vector<2xi1>, vector<2xi8> into vector<2xi8>
221221
// CHECK: %[[BITCAST2:.+]] = vector.bitcast %[[MASKEDLOAD]] : vector<2xi8> to vector<8xi2>
222-
// extracts:
223222
// CHECK: %[[CST1:.+]] = arith.constant dense<false> : vector<8xi1>
224223
// CHECK: %[[EX4:.+]] = vector.extract %[[MASK]][0] : i1 from vector<3xi1>
225224
// CHECK: %[[IN4:.+]] = vector.insert %[[EX4]], %[[CST1]] [%[[LINEAR2]]] : i1 into vector<8xi1>

0 commit comments

Comments
 (0)